The following snippet is shown in some Firebase Flutter examples.
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
What is the benefit of passing DefaultFirebaseOptions.currentPlatform
to Firebase.initializeApp()
?
The options
parameter is nullable (optional).
I wonder if passing something called "Default..." to an optional parameter might not make a difference.
If you don't pass any options to Firebase.initializeApp
the SDK will be initialized with the information from the GoogleService-Info.plist
(iOS), GoogleServices.json
(Android) or the JavaScript snippet (web).
If you pass a value for options
(typically read from FirebaseOptions.dart
), the SDK will be initialized with that.
If the files and the Dart code have the same values (as is typically the case when you use the flutterfire
CLI to manage things), there is no real difference - but passing the options
will give you better debug info.