[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Unsupported operation: DefaultFirebaseOptions have not been configured for windows - you can reconfigure this by running the FlutterFire CLI again.
4 Answers
You can initialise using option like this
await Firebase.initializeApp(
// Replace with actual values
options: const FirebaseOptions(
apiKey: "api key here",
appId: "app id here",
messagingSenderId: "messaging id",
projectId: "project id here",
),
You can get these values from firebase console
I received this error when I didn't install Firebase (with Flutterfire) for the platform I was using. For example, I had configured Firebase for iOS and Android but not for Web, and when I tried to load my app via Chrome, it would throw this error.
Try 'flutterfire configure' from your app directory which should allow you to resolve this!
-
is it safe to call 'flutterfire configure' in an existing flutter project that is already connected to firebase (android & ios with google-services.json and GoogleService-Info.plist)?– CedricJan 9 at 5:02
Try to change another device if you're using windows for running flutter app. That works for me.
or try to change
await Firebase.initializeApp(
//options: DefaultFirebaseOptions.android, // if you're using windows emulator
//options: DefaultFirebaseOptions.ios, // if you're using windows emulator
options: DefaultFirebaseOptions.web, // for web
);
flutterfire configure
running this will show you the options for the configuration of your flutter project like android, web, ios, and macOS.
But if you are not getting the option of any of them you can create an app manually just go to the firebase console, and there you will see something like this.
here you can see that under the online placement, portal heading I have two apps only, which are android when you got to your firebase console you will see something different you might have any one out of four missings (android, web, ios, macOS) like in your case there will be no android app you can click simply plus button and add it manually. after adding it you can go to the project and can run it again
flutterfire configure
you will select android and move forward without an error.
flutterfire configure
?