0

I was working on a flutter web app and a power outage broke my firebase options. Here is the error I get:

Running "flutter pub get" in flutter_tools...
Launching lib\main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
DartUri: Unresolved uri: dart:web_sql
DartUri: Unresolved uri: dart:ui
This app is linked to the debug service: ws://127.0.0.1:52488/knxO4BrQ_6M=/ws
Debug service listening on ws://127.0.0.1:52488/knxO4BrQ_6M=/ws
Running with sound null safety 
Debug service listening on ws://127.0.0.1:52488/knxO4BrQ_6M=/ws
Error: Assertion failed: 
file:///C:/Users/niema/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/lib/src/firebase_core_web.dart:207:11
options != null
"FirebaseOptions cannot be null when creating the default app."
at Object.throw_ [as throw] (http://localhost:52440/dart_sdk.js:5069:11)
at Object.assertFailed (http://localhost:52440/dart_sdk.js:4994:15)
at firebase_core_web.FirebaseCoreWeb.new.initializeApp (http://localhost:52440/packages/firebase_core_web/firebase_core_web.dart.lib.js:226:42)
at initializeApp.next (<anonymous>)
at http://localhost:52440/dart_sdk.js:40627:33
at _RootZone.runUnary (http://localhost:52440/dart_sdk.js:40497:59)
at _FutureListener.thenAwait.handleValue (http://localhost:52440/dart_sdk.js:35424:29)
at handleValueCallback (http://localhost:52440/dart_sdk.js:35985:49)
at _Future._propagateToListeners (http://localhost:52440/dart_sdk.js:36023:17)
at [_completeWithValue] (http://localhost:52440/dart_sdk.js:35858:23)
at http://localhost:52440/dart_sdk.js:35063:46
at _RootZone.runUnary (http://localhost:52440/dart_sdk.js:40497:59)
at _FutureListener.then.handleValue (http://localhost:52440/dart_sdk.js:35424:29)
at handleValueCallback (http://localhost:52440/dart_sdk.js:35985:49)
at _Future._propagateToListeners (http://localhost:52440/dart_sdk.js:36023:17)
at [_completeWithValue] (http://localhost:52440/dart_sdk.js:35858:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:52440/dart_sdk.js:35892:35)
at Object._microtaskLoop (http://localhost:52440/dart_sdk.js:40764:13)
at _startMicrotaskLoop (http://localhost:52440/dart_sdk.js:40770:13)
at http://localhost:52440/dart_sdk.js:36247:9

Here is what I have tried to fix it:

  • deleted pubspec.lock because it gave some long binary error of 001001

  • ran a flutter clean and flutter pub get

  • deleted pub cache in flutter folder

  • deleted cache folder located in C:/Users/niema/AppData/Local/Pub

  • cloned the project again from github

Mario Niemand
  • 93
  • 1
  • 12

1 Answers1

0
  • Run flutter channel stable
  • Run flutter upgrade
  • Replace await Firebase.initializeApp() with await Firebase.initializeApp( options: const FirebaseOptions( apiKey: "XXX", appId: "XXX", messagingSenderId: "XXX", projectId: "XXX", ), );
  • Restart the app.

Or if that doesn't work, there's another thread that treats the same error here: https://stackoverflow.com/a/70234018/7156819

Răzvan Puiu
  • 671
  • 1
  • 6
  • 24