How to configure Firebase in Flutter?

1. Configure Dependencies

$ flutter pub add firebase_core 
Resolving dependencies...
+ firebase_core 1.10.5
+ firebase_core_platform_interface 4.2.2
+ firebase_core_web 1.5.2
+ flutter_web_plugins 0.0.0 from sdk flutter
+ js 0.6.3
  test_api 0.4.3 (0.4.8 available)
Changed 5 dependencies!
$ flutter pub add firebase_auth
Resolving dependencies...
+ firebase_auth 3.3.3
+ firebase_auth_platform_interface 6.1.8
+ firebase_auth_web 3.3.4
+ intl 0.17.0
  test_api 0.4.3 (0.4.8 available)
Changed 4 dependencies!
$ flutter pub add cloud_firestore
Resolving dependencies...
+ cloud_firestore 3.1.4
+ cloud_firestore_platform_interface 5.4.9
+ cloud_firestore_web 2.6.4
  test_api 0.4.3 (0.4.8 available)
Changed 3 dependencies!
$ flutter pub add provider
Resolving dependencies...
+ nested 1.0.0
+ provider 6.0.1
  test_api 0.4.3 (0.4.8 available)
Changed 2 dependencies!

2. Install flutterfire

$ dart pub global activate flutterfire_cli

You might face some warnings tell you need to configure your system environmental path first. Then try this way:

npm install -g firebase-tools

dart pub global activate flutterfire_cli

For me, the warnings got resolved.

3. Configure Application

$ flutterfire configure

You might be told that you should login first, however the login command line would be forbidden in the system. Then try this way:

3.1. delete firebase.ps1 based on the prompt information.
3.2. clean the cache by
npm cache clean --force
3.3. run command again
$ flutterfire login

After you login successfully, run

$ flutterfire configure