Home > Enterprise >  flutter web not working due to await statement
flutter web not working due to await statement

Time:11-23

I am having issues with Flutter web when I use await statement,

void main() async {
  //debugPaintSizeEnabled = true;
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}

this will not display anything on the browser and throws and error:

ChromeProxyService: Failed to evaluate expression 'title': InternalError: Expression evaluation in async frames is not supported. No frame with index 39..

I am stuck :(

debugging testing nothing worked

CodePudding user response:

Run flutter channel stable followed by flutter upgrade --force

CodePudding user response:

When using Firebase, you need to initalize it with options for the specific platform that you are using. Here goes and example on how to configure it for Flutter Web:

 import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;

 void main() async {
    //debugPaintSizeEnabled = true;
    WidgetsFlutterBinding.ensureInitialized();
    await Firebase.initializeApp(
        options = FirebaseOptions(
            apiKey: 'YOUR API KEY',
            appId: 'YOUR APP ID',
            messagingSenderId: 'YOUR MESSAGING SENDER ID',
            projectId: 'YOUR PROJECT NAME',
            authDomain: 'YOUR AUTH DOMAIN (IF YOU HAVE)',
            databaseURL: 'YOUR DATABASE URL (IF YOU USE FIREBASEDATABASE)',
            storageBucket: 'YOUR STORAGE BUCKET',
        )
    );
    runApp(MyApp());
}

All this information is available on your Firebase Project Console, just search for it. Hope it helps!

  • Related