Home > other >  Flutter user add their own firebase database
Flutter user add their own firebase database

Time:12-29

I am new in Flutter and i'm try to build aplication working with the database. In app I would for the user to add their own firebase database to working with with app. This is possible to add firebase database after build the app? Please information about this.

Thanks for any sugestions

CodePudding user response:

You need to set it up first, here's a link https://firebase.flutter.dev/docs/overview/

CodePudding user response:

You can specify the configuration data for the Firebase project in your Dart code as shown in this example in the FlutterFire docs:

FirebaseOptions get firebaseOptions => const FirebaseOptions(
      appId: '1:448618578101:ios:0b650370bb29e29cac3efc',
      apiKey: 'AIzaSyAgUhHU8wSJgO5MVNy95tMT07NEjzMOfz0',
      projectId: 'react-native-firebase-testing',
      messagingSenderId: '448618578101',
    );

Future<void> initializeDefault() async {
  FirebaseApp app = await Firebase.initializeApp(
    options: DefaultFirebaseConfig.platformOptions,
  );
  print('Initialized default app $app');

This means you can get the necessary from the user or in another way at runtime, and only then initialize the app.

If you don't want to request the user to enter these details manually, you can use the REST API for managing projects to get a list of the user's projects. There is no Flutter/Dart wrapper for this API that I know off, so you'll have to write that yourself.

  • Related