Change dinamically the Firebase DB using the 'google-services.json'

Hello from Spain! I’m new on flutter, and im working on a project that needs to change dynamically the url of the Firebase DB. I was thinking to modify the ‘google-services.json’ but I don’t know the way to modify a .json in flutter. The idea is that the person who maintain the application can add it’s own database. It would be helpful for me if someone tried to do something similar, or knows how to modify a .json. Thank you!

1 Like

Hi @elputosenen Changing google-services.json is not a good approach. If you just want to change the endpoint, then I think you should have a “Settings” section in your App.

Here you can ask the user to add the the url/db name and then set the end point accordingly. And then you can save this url in shared preferences so that it doesn’t need to be set every time the user opens the App.

Please let me know if this approach helps :slight_smile:


Yes! the problem is that the url of my database is configured inside of that json, with the secret key and other parameters. I cannot interact directly with the database url, I don’t know if I am enought clear with my bad english!