Install firebase_core
and add the initialization code to your app if you haven’t already.
Install firebase cli (firebase_core
)
https://firebase.google.com/docs/cli#setup_update_cli
Check firebase cli installed correctly
firebase -V
Login to firebase
firebase login
you will see this message Success! Already logged in as example@gmail.com
if already logged in.
if not loggedin then it will ask collect CLI and Emulator Suite usage and error reporting information?
the choice is yours you can type y/n and click. enter.
It opens the browser and ask to login in to firebase google account.
once loggedin ✔ Success! Logged in as example@gmail.com
If you see different account was loggedin
firebase logout
once firebase login was done please activate the Firebase CLI for your project
Activate Firebase CLI
dart pub global activate flutterfire_cli
you will see this message Activated flutterfire_cli Version.
Configure your apps to use Firebase
Install firebase core to flutter
flutter pub add firebase_core
flutterfire configure
create or select firebase project
select platforms
In code base
In your lib/main.dart
file
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
Also in your lib/main.dart
file, initialize Firebase using the DefaultFirebaseOptions
object exported by the configuration file:
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(const MyApp());
Firebase setup completed
Once installed you can do
you can Install firebase Google analytics to flutter