currentPlatform property

FirebaseOptions get currentPlatform

Retrieves the FirebaseOptions for the current platform.

Determines the platform (web, Android, iOS, macOS, Windows) and returns the corresponding Firebase configuration. Throws an UnsupportedError for unsupported platforms like Linux.

Returns: A FirebaseOptions object for the current platform.

Throws:

Implementation

static FirebaseOptions get currentPlatform {
  if (kIsWeb) {
    return web;
  }
  switch (defaultTargetPlatform) {
    case TargetPlatform.android:
      return android;
    case TargetPlatform.iOS:
      return ios;
    case TargetPlatform.macOS:
      return macos;
    case TargetPlatform.windows:
      return windows;
    case TargetPlatform.linux:
      throw UnsupportedError(
        'DefaultFirebaseOptions have not been configured for linux - '
        'you can reconfigure this by running the FlutterFire CLI again.',
      );
    default:
      throw UnsupportedError(
        'DefaultFirebaseOptions are not supported for this platform.',
      );
  }
}