Home > Blockchain >  Unhandled Exception: [core/duplicate-app] A Firebase App named "[DEFAULT]" already exists
Unhandled Exception: [core/duplicate-app] A Firebase App named "[DEFAULT]" already exists

Time:01-28

[1]what solution of this error ? s

Unhandled Exception: [core/duplicate-app] A Firebase App named "[DEFAULT]" already exists E/flutter (18435): MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:113:11)

CodePudding user response:

Wrap the firebase app initialisation in a try-catch like so:

void main() async{
 try {
   WidgetsFlutterBinding.ensureInitialized();
   await Firebase.initializeApp();
 } catch (e) {}
 runApp(MyApp());
}

  •  Tags:  
  • Related