getFirebaseAppFromFile method

Future<FirebaseApp> getFirebaseAppFromFile(
  1. Map<String, dynamic> config
)

Get firebase app object from service file path.

Implementation

Future<FirebaseApp> getFirebaseAppFromFile(
    Map<String, dynamic> config) async {
  // // Read the service account file (assuming it's a JSON file)
  // Uint8List fileBytes = await File(filePath).readAsBytes();
  // log(filePath.toString());
  // // Parse the JSON content
  // String content = String.fromCharCodes(fileBytes);
  // Map<String, dynamic> config = jsonDecode(content);
  // log(filePath.toString());
  // // Extract Firebase options
  FirebaseOptions options = FirebaseOptions(
    apiKey: config['apiKey'],
    appId: config['appId'],
    messagingSenderId: config['messagingSenderId'],
    projectId: config['projectId'],
    storageBucket: config['storageBucket'],
  ); // Initialize Firebase with the custom configuration
  return await Firebase.initializeApp(
    options: options,
  );
}