firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.44k stars 3.91k forks source link

Concept for instanceFor function #12719

Closed Attempt3035 closed 2 weeks ago

Attempt3035 commented 2 weeks ago

Description

I've had issues with occasionally on particular emulators (usually android) where trying to instance crashlytics results in no default firebase being found, as I don't use the default, I've created a named firebase instance as:

final mainFirebase = await Firebase.initializeApp(
    name: 'master',
    options: DefaultFirebaseOptions.currentPlatform,
);

Shouldn't there be an instanceFor method in crashlytics? My changes in this PR are incomplete and likely not functional, but I don't understand why every other firebase system has instanceFor functionality but crashlytics does not...

Note: I have no experience in the backend of these firebase services, hence this is conceptual and will need advice and clarification from someone with experience :)

russellwheatley commented 2 weeks ago

@Attempt3035 - Firebase Crashlytics can only have a default instance for android and apple. Example, see iOS docs. Hence why FlutterFire only allows creating a default instance.