0

i am getting error in my App after setting up the AppCheck but now i dont think the error is from the AppCheck. I think is from Firebase.initializeApp(). i am confused because everything is working perfect before.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp()
      .then((value) => print("connected " + value.options.asMap.toString()))
      .catchError(
        (e) => print(
          'initialized error ====> ${e.toString()}',
        ),
      );
  await FirebaseAppCheck.instance.activate(
    webRecaptchaSiteKey: 'recaptcha-v3-site-key',
  );
  SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
    statusBarColor: Colors.transparent,
  ));
  SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
      overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]);

  runApp(MyApp());
}

here is the error in Image. the error in Image

Gbenga B Ayannuga
  • 2,407
  • 3
  • 17
  • 38
  • The primary problem is: `MissingPluginException(No implementation discovered for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core`. Without it, `Firebase.initializeApp()` will not work. – Dabbel Apr 24 '22 at 09:19

1 Answers1

0

Try removing then since you already have await syntax.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await FirebaseAppCheck.instance.activate(
    webRecaptchaSiteKey: 'recaptcha-v3-site-key',
  );
  SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
    statusBarColor: Colors.transparent,
  ));
  SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
      overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]);

  runApp(MyApp());
}
Shri Hari L
  • 4,551
  • 2
  • 6
  • 18