Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[all plugins] All plugins should have a static instance member, and a static instanceFor() method if arguments are allowed #1377

Closed
collinjackson opened this issue Nov 6, 2019 · 1 comment
Labels
type: enhancement New feature or request

Comments

@collinjackson
Copy link
Contributor

collinjackson commented Nov 6, 2019

This is a breaking change that we'd like to land as part of our push towards stabilizing the Flutterfire API and authoring integration tests that work across web and mobile (see #40).

Currently the Flutterfire plugins are inconsistent about how you get an instance of the plugin. Some, like firebase_analytics, offer only an anonymous constructor: FirebaseAnalytics(). Others have a static final instance member. Some, like cloud_firestore, have both. The anonymous constructor sometimes takes additional arguments, as in the case of firebase_storage.

The following change is proposed:

  • All plugins (except core) should have a FirebaseXXX.instance member that uses the default Firebase app.
  • If the plugin offers optional named constructor arguments such as multiple app support, a FirebaseXXX.instanceFor() factory constructor should be provided.
  • The method should return the same instance when passed identical arguments.
  • Anonymous constructors should be deprecated and removed in a subsequent release.
@collinjackson collinjackson added the type: enhancement New feature or request label Nov 6, 2019
@collinjackson collinjackson changed the title [all plugins] Multiple app support should use FirebaseXXX.instanceFor() [all plugins] All plugins should have instance member, and a instanceFor() method if arguments are allowed Nov 6, 2019
@collinjackson collinjackson changed the title [all plugins] All plugins should have instance member, and a instanceFor() method if arguments are allowed [all plugins] All plugins should have a static instance member, and a static instanceFor() method if arguments are allowed Nov 6, 2019
@Salakar
Copy link
Member

Salakar commented Jul 10, 2020

Hey, this is being addressed as part of our on-going work for #2582, with Core & Firestore already being standardized with other plugins to follow in the coming weeks.

@Salakar Salakar closed this as completed Jul 10, 2020
@firebase firebase locked and limited conversation to collaborators Aug 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants