googlearchive / firebase-dart

Dart wrapper for Firebase
https://pub.dev/packages/firebase
404 stars 144 forks source link

Errors when building for Android #387

Closed vinnytwice closed 3 years ago

vinnytwice commented 3 years ago

I'm not sure what I changed as my app was built and is in my Android tablet, but last week I started getting a long list of errors and the build fails. I use firebase package for the web version of the app, and I basically initialise it in a Singleton and my repositories are all with conditional import via a Stub / Switcher(abstract class an methods) / WebImplementation ( using firebase package methods ) / DeviceImplementation ( using official packages methods) as I show here in my answer to my own question.. https://stackoverflow.com/questions/59670753/flutter-firebase-realtime-database-in-web/61982735#61982735 It all worked great until I switched to Firestore.. but the errors don't seem Firestore related.. I get same errors with 7.3.3 version. Can you spot what's goin' one here?? Thank you very much.

Running Gradle task 'assembleDebug'...
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/top_level.dart:1:8: Error: Not found: 'dart:html'
import 'dart:html';
       ^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:2:8: Error: Not found: 'dart:html'
import 'dart:html';
       ^
/Users/vinnytwice/Developer/flutter/packages/flutter/lib/src/foundation/_platform_web.dart:5:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
       ^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js.dart:8:1: Error: Not found: 'dart:js'
export 'dart:js' show allowInterop, allowInteropCaptureThis;
^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util'
export 'dart:js_util';
^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/auth.dart:337:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var nextWrapper = allowInterop((firebase_interop.UserJsImpl user) {
                        ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/auth.dart:341:26: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var errorWrapper = allowInterop((e) => _changeController.addError(e));
                         ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/auth.dart:374:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var nextWrapper = allowInterop((firebase_interop.UserJsImpl user) {
                        ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/auth.dart:379:11: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
          allowInterop((e) => _idTokenChangedController.addError(e));
          ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/database.dart:164:9: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
 - 'DatabaseReference' is from 'package:firebase/src/database.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        allowInterop((update) => jsify(transactionUpdate(dartify(update))));
        ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/database.dart:166:26: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
 - 'DatabaseReference' is from 'package:firebase/src/database.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var onCompleteWrap = allowInterop(
                         ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/database.dart:302:24: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/database.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var callbackWrap = allowInterop((
                       ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/database.dart:331:30: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/database.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    jsObject.once(eventType, allowInterop(
                             ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/database.dart:412:22: Error: The method 'allowInterop' isn't defined for the class 'DataSnapshot'.
 - 'DataSnapshot' is from 'package:firebase/src/database.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var actionWrap = allowInterop((d) => action(DataSnapshot.getInstance(d)));
                     ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/messaging.dart:72:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final nextWrapper = allowInterop((payload) {
                          ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/messaging.dart:75:28: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final errorWrapper = allowInterop((e) {
                           ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/messaging.dart:87:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final nextWrapper = allowInterop((payload) {
                          ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/messaging.dart:97:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final nextWrapper = allowInterop((_) => null);
                          ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/messaging.dart:98:28: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final errorWrapper = allowInterop((e) {
                           ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/storage.dart:320:11: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
 - 'UploadTask' is from 'package:firebase/src/storage.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
          allowInterop((storage_interop.UploadTaskSnapshotJsImpl data) {
          ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/storage.dart:324:26: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
 - 'UploadTask' is from 'package:firebase/src/storage.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var errorWrapper = allowInterop((e) => _changeController.addError(e));
                         ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/storage.dart:325:26: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
 - 'UploadTask' is from 'package:firebase/src/storage.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var onCompletion = allowInterop(() {
                         ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/top_level.dart:196:7: Error: Method not found: 'hasProperty'.
  if (js.hasProperty(error, 'message')) {
      ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/top_level.dart:197:19: Error: Method not found: 'getProperty'.
    var message = js.getProperty(error, 'message');
                  ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:50:24: Error: Method not found: 'getProperty'.
    map[key] = dartify(util.getProperty(jsObject, key));
                       ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:74:17: Error: Method not found: 'newObject'.
    var jsMap = util.newObject();
                ^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:76:7: Error: Method not found: 'setProperty'.
      util.setProperty(jsMap, key, jsify(value));
      ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:98:12: Error: Method not found: 'allowInterop'.
    return allowInterop(dartObject);
           ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:106:5: Error: Method not found: 'callMethod'.
    util.callMethod(jsObject, method, args);
    ^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:121:19: Error: Method not found: 'promiseToFuture'.
    value = await util.promiseToFuture(thenable);
                  ^^^^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:123:9: Error: Method not found: 'hasProperty'.
    if (util.hasProperty(e, 'code')) {
        ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:134:27: Error: Method not found: 'allowInterop'.
  return PromiseJsImpl<S>(allowInterop((
                          ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:147:5: Error: Method not found: 'allowInterop'.
    allowInterop(c.completeError);
    ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:155:22: Error: Method not found: 'getProperty'.
  String get code => util.getProperty(_source, 'code');
                     ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:158:25: Error: Method not found: 'getProperty'.
  String get message => util.getProperty(_source, 'message');
                        ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:161:22: Error: Method not found: 'getProperty'.
  String get name => util.getProperty(_source, 'name');
                     ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:164:32: Error: Method not found: 'getProperty'.
  Object get serverResponse => util.getProperty(_source, 'serverResponse');
                               ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:167:23: Error: Method not found: 'getProperty'.
  String get stack => util.getProperty(_source, 'stack');
                      ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:178:10: Error: Method not found: 'instanceof'.
  return util.instanceof(object, type);
         ^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:182:18: Error: Getter not found: 'window'.
  Object start = window;
                 ^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/utils.dart:187:13: Error: Method not found: 'getProperty'.
    start = util.getProperty(start, item);
            ^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart:107:30: Error: The method 'allowInterop' isn't defined for the class 'Firestore'.
 - 'Firestore' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var updateFunctionWrap = allowInterop((transaction) =>
                             ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart:308:11: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
 - 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
          allowInterop((firestore_interop.DocumentSnapshotJsImpl snapshot) {
          ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart:312:26: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
 - 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var errorWrapper = allowInterop((e) => controller.addError(e));
                         ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart:447:9: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        allowInterop((firestore_interop.QuerySnapshotJsImpl snapshot) {
        ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart:451:24: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var errorWrapper = allowInterop((e) => controller.addError(e));
                       ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart:779:9: Error: The method 'allowInterop' isn't defined for the class 'QuerySnapshot'.
 - 'QuerySnapshot' is from 'package:firebase/src/firestore.dart' ('/Users/vinnytwice/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-8.0.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        allowInterop((s) => callback(DocumentSnapshot.getInstance(s)));
        ^^^^^^^^^^^^
/Users/vinnytwice/Developer/flutter/packages/flutter/lib/src/foundation/_platform_web.dart:20:41: Error: Getter not found: 'window'.
  final String navigatorPlatform = html.window.navigator.platform?.toLowerCase() ?? '';
                                        ^^^^^^
/Users/vinnytwice/Developer/flutter/packages/flutter/lib/src/foundation/_platform_web.dart:40:12: Error: Getter not found: 'window'.
  if (html.window.matchMedia('only screen and (pointer: fine)').matches) {
           ^^^^^^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
#1      asFileUri (package:vm/kernel_front_end.dart:657:37)
<asynchronous suspension>
#2      writeDepfile (package:vm/kernel_front_end.dart:825:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:572:15)
<asynchronous suspension>
#4      _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:43:22)
#5      starter (package:flutter_frontend_server/server.dart:182:27)
#6      main (file:///opt/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:9:30)
#7      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

FAILURE: Build failed with an exception.

* Where:
Script '/Users/vinnytwice/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 904

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/vinnytwice/Developer/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 25s
Exception: Gradle task assembleDebug failed with exit code 1
vinnytwice commented 3 years ago

Finally found the problem. It of course was due to the update of the cloud_firestore package. As it now has the web version which conflicts with firebase package. The latest compatible version is cloud_firestore: 0.14.0 and until remote config will also have a web version I'm stuck using firebase package for the web version of my apps..

Also the Firebase initialisation method differs: new not working:

class MyApp extends StatelessWidget {
  final Future<FirebaseApp> _initialization = Firebase.initializeApp();
  @override
  Widget build(BuildContext context) {
//    Locale myLocale = Localizations.localeOf(context);

  return FutureBuilder(
    future: _initialization,
      builder: (context, snapshot){
        if(snapshot.hasError){

        }
        if (snapshot.connectionState == ConnectionState.done){
          return MaterialApp(

...

old working:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  BlocSupervisor.delegate = SimpleBlocDelegate();
  setupLocator();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
//    Locale myLocale = Localizations.localeOf(context);
    return MaterialApp(
...

Hope it helps others as Firebase is always breaking the code with almost any update..

EskAere commented 3 years ago

I also have this issue. I'm interested in case someone have found a workaround!

Also following : https://stackoverflow.com/questions/68365453/flutter-with-firebase-realtime-database-mobile-and-web