2021年4月30日星期五

New Flutter App fails when adding dependency cloud_firestore: ^1.0.7

I followed these steps to create a new flutter app and add cloud_firestore dependency

  1. I setup flutter on my MacOS Big Sur 11.2.3

  2. I typed in command line: flutter create test_dependencies

  3. dart migrate --apply-changes

  4. flutter run
    -> The app works fine as a web app. The chrome browsers opens up the app and I can use the counter

  5. I run flutter pub add cloud_firestore

  6. I confirmed that cloud_firestore: ^1.0.7 was added in pubspec.yaml

  7. I run flutter packages get

  8. I run flutter run

Now I get this error. I actually had a larger app and I started with this simple scenario to isolate the problem. This is the simplest app I can write and it still fails. Any help will be appreciated.

*For a more detailed help message, press "h". To quit, press "q".  TypeError: Cannot read property 'app' of undefined      at Object.app$ [as app]      (http://localhost:49342/packages/firebase_core_web/src/interop/core.dart.lib      .js:42:101)      at new cloud_firestore_web.FirebaseFirestoreWeb.new      (http://localhost:49342/packages/cloud_firestore_web/src/write_batch_web.dar      t.lib.js:865:64)      at Function.registerWith      (http://localhost:49342/packages/cloud_firestore_web/src/write_batch_web.dar      t.lib.js:788:73)      at Object.registerPlugins      (http://localhost:49342/packages/test_dependencies/generated_plugin_registra      nt.dart.lib.js:29:46)      at main (http://localhost:49342/web_entrypoint.dart.lib.js:41:35)      at main.next (<anonymous>)      at runBody (http://localhost:49342/dart_sdk.js:37229:34)      at Object._async [as async] (http://localhost:49342/dart_sdk.js:37260:7)      at main$ (http://localhost:49342/web_entrypoint.dart.lib.js:40:18)      at http://localhost:49342/main_module.bootstrap.js:19:10      at Array.forEach (<anonymous>)      at window.$dartRunMain      (http://localhost:49342/main_module.bootstrap.js:18:32)      at <anonymous>:1:8      at Object.runMain      (http://localhost:49342/dwds/src/injected/client.js:8656:21)      at http://localhost:49342/dwds/src/injected/client.js:22068:19      at _wrapJsFunctionForAsync_closure.$protected      (http://localhost:49342/dwds/src/injected/client.js:3830:15)      at _wrapJsFunctionForAsync_closure.call$2      (http://localhost:49342/dwds/src/injected/client.js:10905:12)      at Object._asyncStartSync      (http://localhost:49342/dwds/src/injected/client.js:3794:20)      at main__closure1.$call$body$main__closure      (http://localhost:49342/dwds/src/injected/client.js:22080:16)      at main__closure1.call$1      (http://localhost:49342/dwds/src/injected/client.js:22007:19)      at StaticClosure._rootRunUnary [as call$2$5]      (http://localhost:49342/dwds/src/injected/client.js:4153:16)      at _CustomZone.runUnary$2$2      (http://localhost:49342/dwds/src/injected/client.js:12136:39)      at _CustomZone.runUnaryGuarded$1$2      (http://localhost:49342/dwds/src/injected/client.js:12068:14)      at _ControllerSubscription._sendData$1      (http://localhost:49342/dwds/src/injected/client.js:11697:19)      at _DelayedData.perform$1      (http://localhost:49342/dwds/src/injected/client.js:11849:59)      at _PendingEvents_schedule_closure.call$0      (http://localhost:49342/dwds/src/injected/client.js:11898:14)      at Object._microtaskLoop      (http://localhost:49342/dwds/src/injected/client.js:3990:24)      at StaticClosure._startMicrotaskLoop      (http://localhost:49342/dwds/src/injected/client.js:3996:11)      at _AsyncRun__initializeScheduleImmediate_internalCallback.call$1      (http://localhost:49342/dwds/src/injected/client.js:10774:9)      at invokeClosure      (http://localhost:49342/dwds/src/injected/client.js:1250:26)      at MutationObserver.<anonymous>      (http://localhost:49342/dwds/src/injected/client.js:1269:18)*  
https://stackoverflow.com/questions/67341924/new-flutter-app-fails-when-adding-dependency-cloud-firestore-1-0-7 May 01, 2021 at 08:39AM

没有评论:

发表评论