Reputation: 147
My flutter app needs to connect to multiple firebase databases. the vision is that the user will start the application and will enter Firebase parameters and click "Connect". I find the following source lines
FirebaseApp app;
Future<FirebaseApp> FBDB() async {
WidgetsFlutterBinding.ensureInitialized();
final FirebaseApp app = await FirebaseApp.configure(
name: "FB.AAA.com", // "package_name"
options: const FirebaseOptions(
googleAppID: "1:79046:android:2fb2895a41bde78da062d",
// "mobilesdk_app_id"
gcmSenderID: "???",
//"project_number":
apiKey: "AIzamVHoX0C_zimD3UhUITF4ml7Be4fsI",
// "api_key": [ { "current_key"
projectID: "fb-b64d", //"project_id"
),
);
}
The Google Services file is (changed the data):
{
"project_info": {
"project_number": "123",
"firebase_url": "https://fb-b64d.firebaseio.com",
"project_id": "fb-b64d",
"storage_bucket": "fb-b64d.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:79046:android:2fb2895a41bde78da062d",
"android_client_info": {
"package_name": "FB.AAA.com"
}
},
"oauth_client": [
{
"client_id": "123-5555.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzamVHoX0C_zimD3UhUITF4ml7Be4fsI"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "793081656-5555.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
The result of the source code above is null (the object was not created) so my questions are:
Did I take the right parameters from the google Json file to the source code above? what should be in the gcmSenderID?
what is the next step? how should I receive the
final FirebaseAuth _firebaseAuth = FirebaseAuth.instance
In order to start query the DB?
Upvotes: 1
Views: 42
Reputation: 600071
If you want to get a Firebase service for a specific FirebaseApp
instance, you pass that app into the service's constructor or call a factory method.
For example:
FirebaseDatabase(app: this.app).reference();
For for auth:
FirebaseAuth.fromApp(app)
Upvotes: 2