Flutter swap current Firebase Project with another - flutter

I have a current Flutter project which is linked to a Firebase project and is reading and writing from a Realtime Database. My issue is that I have used the wrong project and now want to switch my Flutter app to use a different Project's Realtime Database. Is it possible to switch the Firebase project my app is currently linked to and if so how do I go about doing that?
Thanks

The FlutterFire CLI is a great tool for quickly configuring Firebase resources for Flutter projects and it could be used to switch the Firebase project to which the configuration files in your Flutter project are pointed.
First you could want to set up the FlutterFire CLI by following the instructions on the Firebase site:
Install the Firebase CLI.
Log into Firebase using the Google account under which you have the new Firebase project you want to switch to set up by running the following command: firebase login
Install the FlutterFire CLI by running the following command from any directory: dart pub global activate flutterfire_cli
Then, after getting the FlutterFire CLI set up, it would probably be a good idea to make sure your current Firebase configuration is backed up some how, either using version control or manually.
Finally, to switch your Flutter configuration to a different Firebase project, run flutterfire configure and follow the steps in the workflow, making sure to select the new Firebase project.

Related

Firebase CLI doesn't show project

I am trying to configure my flutter project using flutterfire configure command. However, the CLI tool doesn't show my firebase project I want to configure the app with. What should I do?
CLI output
Firebase console

how to change firebase account in a flutter project?

I created a flutter project with my personal firebase, but now the client has already created his firebase, how do I change the account in a project, I've searched the documentation but without success?
Unfortunately there is no easy way to switch.
The information you configured when you first created flutter project on firebase, it has be configured again with clients Firebase.
For example -> replace old GoogleService-info.plist, android package name and iOS bundleID with the new one.

How do I get flutterfire configure command to work?

I'm developing in flutter and am trying to add firebase to my flutter project.
Firebase login works, auth works, dart pub global activate flutterfire_cli works and flutterfire. I can call on firebase or flutterfire and it will list the options I have so I know the paths and installs are working.
But when I run flutterfire configure I always get this:
'''
flutterfire configure
i Found 0 Firebase projects.
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase --version
ERROR: The FlutterFire CLI currently requires the official Firebase CLI to also be installed, see https://firebase.google.com/docs/cli#install_the_firebase_cli for how to install it.
'''
I've been struggling with this for a few days now and have tried firebase binary, npm, nodejs, and anything else I can find. Nothing seems to be working.
Thanks ahead of time!
Lance
I had the same issue some months Ago. This happens when you have ever initialise firebase on that project, be it for hosting , cloud function e.t.c.
Here is what you should do.
Firstly
Carefully delete files and folders relating to firebase-tools on that project (.firebase , firebase.json , .firebaserc ,functions(if available) and firebase_options.dart (if available));
You can then run your
dart pub global activate flutterfire_cli
flutterfire configure
then incase the you are using flutter web and you care to deploy on firebase hosting
You can now your
firebase init;
note:- firebase init; should on be done after
flutterfire configure
I had the same problem, I had to do the following commands in my project directory for it to work:
export PATH="$PATH":"$HOME/.pub-cache/bin"
dart pub global activate flutterfire_cli
flutterfire configure --project=project_name-genereted_firebaseapp_number

I am trying to connect my flutter app with firebase but it doesn't generate the file named "Generated_plugins_registrant.dart"

I am trying to connect my flutter app with firebase but it doesn't generate the file named "Generated_plugins_registrant.dart", I don't if this has happened to anyone else, and I am using Mac (Idk if using mac is reason). I have added every dependencies and plugins required and I have done everything I can but the file just won't generate.
When I first set up my projects I used the flutterfire cli and it automatically generated what was needed. Hope this helps

Error: Not in a Firebase app directory (could not locate firebase.json)

I am new to coding and building apps. I already have a Firebase project initialized and is connected to my Flutter project (I am using Android Studio). Everything is working fine. However, I am now starting to need to use Cloud Functions and need to use some Firebase Tools and the Firebase emulators for my app. However, when I try to start the emulator I get the following errors.
Error: Not in a Firebase app directory (could not locate firebase.json)
From reading around, it looks like firebase init can resolve this problem, but I already have the project initialized, so I am not sure how to solve this error. Or is it okay to reinitialize the project?
I have firebase, npm, and node all installed on my machine.
project % firebase --version
10.1.5
project % npm --version
6.14.15
project % node --version
v14.18.0
I am not sure but the problem I think is Error: Not in a Firebase app directory (could not locate firebase.json)
Make sure your project has firebase.json or google-services.json.
if you haven't installed firebase tools
npm install -g firebase-tools
then
firebase init
Lets go through some steps and see if we can solve it:
First of all, have you added firebase.json to your project ?
Have you verified that the package name of the firebase.json file matches your project package name? - Check if it is the same packagename as your project
Have you connected/gotten the SHA-1 key and connected it to your firebase project?
enter image description here