# Solved [core/no-app] No Firebase App '[DEFAULT]' has been created - call Firebase.initializeApp()

While using Firebase services in Flutter, you may get "\[core/no-app\] No Firebase App'\[DEFAULT\]' has been created - call Firebase.initalizeApp()". Error in flutter. This error is caused when you use any Firebase servies such as Cloud Messaging, Firestore without initializing Firebase core.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707230227715/71068bf6-8355-4ae8-9e08-f12715b4f1b4.png align="center")

This cause of this error is you might not have initialized firebase before using firebase service.

### How to solve this error?

  
To solve this error, add firebase core Flutter package in your project by adding the following lines in pubspec.yaml file:

```plaintext
dependencies:
  flutter:
    sdk: flutter
  firebase_core: ^2.15.0
```

Now in main() method of main.dart file, initialize Firebase like below before using any Firebase services:

```plaintext
import 'package:firebase_core/firebase_core.dart';
void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Firebase.initializeApp();
   //initilization of Firebase app
  
  // other Firebase service initialization

  runApp(MyApp());
}
```

Adding WidgetsFlutterBinding.ensureInitialized();  
and await Firebase.initializeApp(); with async will solve the problem. Thank you
