currentPlatform method
FirebaseOptions currentPlatform (Map<String, dynamic> androidFirebaseOptions, Map<String, dynamic> iosFirebaseOptions)
Builds and returns FirebaseOptions based on the current platform.
Switches on the current platform and calls android or iOS
methods accordingly to build the FirebaseOptions. Throws
UnsupportedError if the platform is other than these two.
params:
androidFirebaseOptions
: Firebase Options for AndroidiosFirebaseOptions
: Firebase Options for iOS
returns:
FirebaseOptions
: The FirebaseOptions built according to the platform.
Implementation
static FirebaseOptions currentPlatform(
Map<String, dynamic> androidFirebaseOptions,
Map<String, dynamic> iosFirebaseOptions,
) {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android(androidFirebaseOptions);
case TargetPlatform.iOS:
return ios(iosFirebaseOptions);
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}