firebase_options.dart does not exist in a Flutter project
Target of URI doesn't exist: 'firebase_options.dart'.Short answer
firebase_options.dart is not part of a normal Flutter project. The FlutterFire CLI generates it in lib/ when you run flutterfire configure from the project folder. If the import fails, you have not run it yet, you ran it elsewhere, or you added a platform since. Run it again and import the file in main.dart.
Fix it fast
1Find out which cause you have
Check whether the file exists in lib/ of the project you are running.
ls lib/firebase_options.dart2Match what you see, then jump to its fix
- 1
ls says No such file, and tutorials mention a file you do not haveflutterfire configure was never runFix - 2
The file exists somewhere else, or main.dart does not import itYou ran it in another folder, or the import is missingFix - 3
The file exists, but a platform you added has no optionsA new platform or Firebase product was added after configuringFix
- 1
What does the error look like?
Target of URI doesn't exist: 'firebase_options.dart'.Undefined name 'DefaultFirebaseOptions'.
Cause 1 of 3
flutterfire configure was never run
1Check
The Firebase setup guide says the configure step creates firebase_options.dart and adds it to lib/.
dart pub global list | grep flutterfire2Fix
Install the tools, then run configure from the Flutter project directory.
firebase login
dart pub global activate flutterfire_cli
flutterfire configure3Verify
The file now exists.
ls lib/firebase_options.dartConfirmed by firebase.google.com
Cause 2 of 3
You ran it in another folder, or the import is missing
1Check
The guide runs the command from your Flutter project directory, and main.dart imports firebase_options.dart next to firebase_core.
grep -n "firebase_options" lib/main.dart2Fix
Run configure in the project root, and initialize Firebase with the generated options before runApp.
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(const MyApp());
}3Verify
Rebuild; the analyzer shows no missing import.
flutter pub add firebase_core && flutter runConfirmed by firebase.google.com
Cause 3 of 3
A new platform or Firebase product was added after configuring
1Check
The guide says to run flutterfire configure again when you add a platform or Firebase product.
git log --oneline -3 -- lib/firebase_options.dart2Fix
Run configure again and select the new platforms.
flutterfire configure3Verify
Run the app on the new platform.
flutter runConfirmed by firebase.google.com
How do I stop it coming back?
- Commit firebase_options.dart so teammates do not have to regenerate it.
- Re-run flutterfire configure whenever you add a platform.
- Call WidgetsFlutterBinding.ensureInitialized() before Firebase.initializeApp.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- SessionBirdAn omnichannel engagement suite in Flutter: campaigns, chatbot, tickets, analytics and live calling.
- WorkforceA field app, an admin console and a self-hosted Node.js server for push and reconciliation.
- Spotless LaundryAn on-demand laundry app: Flutter on a Laravel back end, with Firebase for live updates.
Related fixes
Mobile apps
flutterfire configure fails with FirebaseCommandException from the Firebase CLI
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
flutterfire configure runs the Firebase CLI underneath, so any CLI failure surfaces as FirebaseCommandException.
4 causes, each with a fixMobile apps
FirebaseUser no longer exists in firebase_auth
Undefined class 'AuthResult'.
FirebaseUser was renamed User in firebase_auth 0.18.
3 causes, each with a fixMobile apps
Gradle cannot find com.google.firebase:firebase-analytics-ktx
Required by: project :app
Firebase moved the Kotlin extensions into the main modules and stopped releasing the -ktx modules in July 2025.
2 causes, each with a fixMobile apps
AudioCache has no play method after updating audioplayers
The method 'play' isn't defined for the type 'AudioCache'.
Since audioplayers 1.0, AudioCache only turns asset files into local files and caches them.
2 causes, each with a fixMobile apps
Flutter Bloc throws that emit was called after the event handler completed
emit was called after an event handler completed normally.
Each on<Event> handler gets its own Emitter, and it stops working the moment the handler's returned Future completes.
2 causes, each with a fixMobile apps
analysis_options.yaml: the URI it includes can't be found
include_file_not_found
The analyzer reports include_file_not_found when the file named after include: in analysis_options.yaml does not resolve.
2 causes, each with a fix