Answers for "core.mjs:6485 error firebaseerror: firebase: no firebase app '[default]' has been created - call firebase app.initializeapp() (app/no-app)."

4

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

import 'package:firebase_core/firebase_core.dart';

void main() async {
   WidgetsFlutterBinding.ensureInitialized();
   await Firebase.initializeApp();
   runApp(MyApp());
}
Posted by: Guest on May-07-2021
1

firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp()

//It means you have not initialized your app. 
//Maybe the location of the firebase_config file is written wrong. 
//Else you can initialise your app by this script:

var firebaseConfig = {
  apiKey: " <Provided by Firebase> ",
  authDomain: " <Provided by Firebase> ",
  projectId: " <Provided by Firebase> ",
  storageBucket: " <Provided by Firebase> ",
  databaseURL: " <Provided by Firebase> ",
  messagingSenderId: " <Provided by Firebase> ",
  appId: " <Provided by Firebase> ",
  measurementId: " <Provided by Firebase> "
  
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
var storage = firebase.storage();
var storageRef = firebase.storage().ref();
Posted by: Guest on January-15-2022
0

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

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

class MyApp extends StatelessWidget {
  var fsconnect = FirebaseFirestore.instance;

  myget() async {
    var d = await fsconnect.collection("students").get();
    // print(d.docs[0].data());

    for (var i in d.docs) {
      print(i.data());
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      appBar: AppBar(
        title: Text('Firebase Firestore App'),
      ),
      body: Column(
        children: <Widget>[
          RaisedButton(
            child: Text('send data'),
            onPressed: () {
              fsconnect.collection("students").add({
                'name': 'sarah',
                'title': 'xyz',
                'email': '[email protected]',
              });
              print("send ..");
            },
          ),
          RaisedButton(
            child: Text('get data'),
            onPressed: () {
              myget();
              print("get data ...");
            },
          )
        ],
      ),
    ));
  }
}
Posted by: Guest on September-07-2020

Code answers related to "core.mjs:6485 error firebaseerror: firebase: no firebase app '[default]' has been created - call firebase app.initializeapp() (app/no-app)."

Browse Popular Code Answers by Language