This is my initial_bindings.dart. I am trying to integrate my app to firebase and I get this error everytime I try to run it through an emulator.
import 'package:grabbit_v6/data/apiClient/api_client.dart';
import 'package:firebase_core/firebase_core.dart';
import '../../firebase_options.dart';
class InitialBindings extends Bindings {
@override
void dependencies() async {
Get.put(PrefUtils());
Get.put(ApiClient());
Connectivity connectivity = Connectivity();
Get.put(NetworkInfo(
// ignore: todo
connectivity)); //TODO : run command "flutterfire configure" to generate firebase_options file
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
}
}
Replace the values from firebase
await Firebase.initializeApp(
options: FirebaseOptions(
apiKey: "Api key here",
appId: "App id here",
messagingSenderId: "Messaging sender id here",
projectId: "project id here",
),
);
Checkout FlutterFire Getting Started documentation
Steps:
dart pub global activate flutterfire_cliflutterfire configureThis command will list out all your firebase projects & allow you to choose the project you want to use. Once this command completes successfully, it should generate a file 'firebase_options.dart' from which you can import DefaultFirebaseOptions.currentPlatform
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With