Hello I am using flutter firebase and when I call the Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform,) function in the main() function the
Unable to establish connection on channel.
exception is thrown.
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(const MyApp());
}
Thanks for your help
CodePudding user response:
You have to pas your other information also like this
options: FirebaseOptions(
apiKey: "XXX",
appId: "XXX",
messagingSenderId: "XXX",
projectId: "XXX",
)
and flutter clean then flutter pub get then run it