Closed Salakar closed 3 years ago
I have been working a lot recently with Flutter Web with Flutter Fire plugins and have found a few issues that I would like to raise concerns over. Just to impart the view-point/knowledge. I'll let you do what you will with the info.
Federated Plugin Interfaces
I had a bug the other day because the confirmPasswordReset
function of firebase_auth
was not implemented on the web package. I found it weird that it even happened. Turns out that the base class for the Platform Interface implements all the functions and marks them to throw Unimplemented. I think this is unacceptable. It's the platform specific implementations job to mark a function as unimplemented and not the base class, or as functions are added to the interface we don't know which platform implementations have that feature. This is what happened with this simple use-case. I feel this design decision should be looked in to further.
Platform Interface Standards
It should be clear/tested that the expectation of functionality of an platform interface is maintained. For example, I was working with cloud_firestore
and in this situation the previous un-federated plugin allowed you to compare DocumentReference's. This was then federated and it broke the comparison operator. PR Here.
Another example is google_sign_in
(I know not in this repo). It's signIn
function is documented and suppose to return null when the user cancels/closes the sign in popup. Currently with the web version it throws.
Poor Platform Interface Error Handling
I worked very hard a long time across to standardise the reported Errors from firebase_auth
I made sure that each method was correctly documented. The federated plugin has destroyed this. The web implementation is practically impossible for a developer to deal with specific errors such as "user not found". I would love to discuss this point and help on it where I can. But to me it seems practical to come up with a base exception class all FlutterFire plugins use from core and then for each plugin to extend it with specifics for each. For sure the plugin error class should be listed in the comments on every interface method with a list of code
field responses so that the developer can deal with exceptional conditions and display the correct UX.
I know this might be a critical view-point, but hope the points are discussed internally. I am happy to help where I can to further discussion over these and other issues.
Hey @slightfoot thanks for your comments, they're super useful.
- Federated Plugin Interfaces
This library was created before Flutter Web was available, so at the time there were a lot of code decisions made which may not have considered the impact a Federated plugin setup would have when it was introduced. As it stands, FlutterFire web & native implementations are mis-aligned with each other feature wise. This is something we're working towards (starting with getting tests in place to catch these issues).
implements all the functions and marks them to throw Unimplemented. I think this is unacceptable.
The Platform Interfaces are like this by design to ensure that any platform specific code which wraps onto the plugin ensures that something happens if the underlying platform code (the delegates) don't provide functionality for the "call". If this happens, it should be a signal to flag an issue that something is indeed missing - this could also be a 3rd party platform implementation which is using the Platform Interface.
- Platform Interface Standards
This boils down to the problem mentioned in the first section. Right now tests are lacking to help identify these sorts of problems but that's something we're working towards (as part of the "1.0" release cycle).
The plugins without a current web implementation will also be developed at some point in the future to work with the platform interfaces we'll create for each.
- Poor Platform Interface Error Handling
We plan to provide a public FirebaseException
class which all Firebase related errors should filter through for each platform. Right now, the firebase_core_web
plugin wraps the firebase-dart
library, which wraps the Firebase JS SDK. If an error is thrown on the web, the error message returned is JavaScript SDK related (not very handy for FlutterFire users). Luckily, Firebase errors return a code (e.g. core/no-app
). If such an error is trapped on the JS side, we can throw a specific FirebaseException
with the same message across all platforms. Once the Core rework PR lands, you can take a look in there - it's not ideal however it does help solve this problem.
Thanks for bringing the development of Firebase for Flutter forward!
However, I am missing on the roadmap packages like Remote Config and Analytics!
Both are more popular than some other packages on the roadmap, however I do understand that the first 6 are for paid products.
Also, a proper Crashreporting for Flutter would be great, not tied to a Native implementation via Platform channels, but rather a first class Dart integration of Crashlytics, this would then work on all platforms out of the box!
@Salakar and the team, thanks for taking over this important part of the Flutter ecosystem! I just wanted to ping you about an IMHO important issue and tried to link the mentioned GitHub team, but it seems the mentioned team is missing. A typo or something?
I think an argument can be made that this PR to implement the New Crashlytics SDK:
[firebase_crashlytics]Migrate to new Crashlytics SDK #2288
is perhaps even more urgent than some of the others. Because most/'all' flutter production apps need a crash and error reporting solution. Where as Cloud Storage or Cloud Functions ... perhaps not so much.
Looking at FlutterFire Roadmap #2582, it looks like the FlutterFire plugins are going towards much more stable and consistent design. There's one point I would like to add. As mentioned by @slightfoot, currently, it's very difficult to know what all kinds of exceptions might get thrown from a Firebase plugin on any given function (esp. Firestore (#1223) and Firebase Auth) and this leads to a poor UX feedback to the users. It's even difficult when writing tests or passing those errors as failures down the domain and UI layer. I tried finding a comprehensive doc of errors but could not get and concrete results.
I think that along with consolidating all the existing platform exceptions to a single place, if for the time being, we could get basic documentation with details of current implementation up and running[Related: #183] (esp. containing common ones such as Network/Timeout etc.), it could help take the pressure off as a workaround and can act as a base doc while working collaboratively on revamping the plugins. If there's already something in place on similar lines, please point to that too. Would love to contribute to this revamp process!
For Auth, there is a well-documented list in the JS SDK reference [1]. I would appreciate if error documentation not just for Flutter, but across all Firebase products and platforms would be improved :)
[1] https://firebase.google.com/docs/reference/js/firebase.auth.Error
For Auth, there is a well-documented list in the JS SDK reference [1]. I would appreciate if error documentation not just for Flutter, but across all Firebase products and platforms would be improved :)
Yep something we're looking at. In cases where Firebase provides an actual error code we can handle. It's trickier when dealing with errors with no code since there's no real way to "check" the error and match it to a global one. In this case, we'll provide error messages which are as similar as possible.
Any hope for a dart native firebase admin sdk?
@SwissCheese5 not on the roadmap right now, but maybe something longer term.
I know it's not native, but here's something I used to keep my project mostly dart: firebase_admin_interop
@Levi-Lesches That's web only unfortunately. The only available package is firebase_admin which only provides firebase auth and firebase storage support, no Firestore. firedart, on the other hand, is meant for dart native clients rather than admin
That's web only unfortunately
It's not web, it's NodeJS, and doesn't run on clients, it runs on the server only.
The only available package is firebase_admin
It's a substitute for firebase_admin
, but is being actively worked on and has many more features. My project uses it to do admin work on Firestore, Firebase Auth, and Firebase Messaging, so if you have any questions I'm happy to help.
@Levi-Lesches So I can use it on a windows/Linux machine and it'll work? I legitimately thought it would crash because it depends on dart:html
Yep! I have a Windows too. It takes some setting up, and you can't use dart:io
(node_interop
, node_io
, and other packages by the same developer will come in handy as replacements for basic dart features), but once you get it running it works very well and supports most of Firebase's features.
I would like to see "common semantic versioning". Firebase products could follow one form of versioning, but it will be super time-saving if we don't have to mix and match between plugins to get a set working.
It has been a problem for us in the past. Just hope that this remains a priority.
Android newbie developers like me are starting new projects in flutter with kotlin support, so take into account that the documentation (i.e FMC) should refer to both java and kotlin version.
Also, there're a lot of FMC issues out there (crashing on start).
Good luck!
@raveesh-me That won't be happening sorry, for a couple of reasons:
That being said, we're working on a "check" which prevents incompatible versions being installed.
@ingmferrer Yep any native changes will be in both Kotlin/Java + Swift/Objc on the docs. We're actually going to be reducing a good number of native steps anyway.
When will storage be available for flutter web?
Finally the slow builds will be looked at :)
Since there is no sdk available for the desktop (windows, linux), wouldn't building a native dart be an evaluable option?
There has been some unofficial work on Firebase SDK in Dart. Firebase Auth and Firestore is already ported but it's done by single person https://github.com/fluttercommunity/firebase_dart_sdk/tree/develop
There's no plans yet, although it has been talked about. Building a new SDK is a whole different story than building on-top of existing ones.
@Ehesp That means we have to build more than one SDK if we want to support other platforms like windows and linux. Maybe implement everything using Dart will be easier? Or use Dart to wrap a single cross-platform native library through FFI?
@ctrysbita yep but you'll be waiting for a long time. I wouldn't say it's not going to happen, but it's not on the roadmap.
Hey everyone 👋 quick progress update;
firebase_core
- our rework of this plugin (and general repository/CI cleanup) has just landed on master 🎉 we'll look at publishing some pre-releases next week. Changes can be seen on #2890.firebase_firestore
- our rework of this plugin is complete but is currently going through internal review. We're hoping to have it up on this repository soon. If you're curious; a preview of the upcoming changes can be seen here.firebase_auth
- our rework of this plugin is nearing completion, but will still need to go through an extensive review. Will post a further update next week.firebase_storage
- currently going through internal planning.firebase_functions
- currently going through internal planning.@Ehesp where does Remote Config lie on this roadmap? What about the AdMob plugin?
@zmeggyesi it's maintained by Google as explained in the first message:
We’ve yet to decide on the order of the remaining plugins, we’ll update you as we progress. Also, the Google team is heavily engaged with the AdMob plugin and will continue to maintain that as a top priority in parallel with this work.
And Remote Config is not in the list, so it will be done sometime after "Cloud Messaging (FCM)". They don't know which package they use next.
@IchordeDionysos I'm aware of that being the initial plan, I was more looking for an update on those two packages, and whether priorities have changed (mostly in response to feedback here highlighting the need for other packages to be tackled).
Hey all, again 🙈 another week, another update:
firebase_core
- prereleases packages are being published shortly via #2907.firebase_firestore
- our rework of this plugin has just landed on master 🎉 we'll look at publishing some pre-releases soon. Changes can be seen on #2913.@Salakar What is the estimated time between 'prereleases shipped' and the released version appearing on pub.dev
? I noticed core merging is blocked due to some checks failing.
Just want to note that the visibility of the roadmap is awesome 🎉 Really keen to see these changes land, thanks for your hard work here!
So no release today after all?
So no release today after all?
@Salakar Just tried to install cloud_firestore-v0.14.0-dev.1
while also trying to install firebase_storage
. Did not work...
Will other Firebase libraries in their current form be compatible with the new Firebase core?
Would it require that each package will get a v1 rework?
Or can I use the Firestore v1 library, and the firebaase_ml_vision
or firebase_in_app_messaging
pre-v1 version together?
@IchordeDionysos yep we're working on that. The plan is to bump the versions of all other modules (without reworking them), but get them to work with the updates. You can see Functions is WIP.
Hey everyone, quick update;
Pre-releases of the reworked Core & Firestore FlutterFire plugins are now available on Pub (as some of you have already been quick to notice 😅). Early adopters & feedback would be hugely appreciated. [View Releases]
Note: as discussed above by @IchordeDionysos & @Ehesp, there may be some incompatibilities with the currently published versions of Auth, Functions & Storage when using the new Firebase Core - we're in the process of publishing pre-releases for these too (only minor internals changes for compatibility, not the rework versions) so please bear with us.
EDIT: functions
prereleases have now been published from #2951
@oranmana I've asked that earlier :) https://github.com/FirebaseExtended/flutterfire/issues/2582#issuecomment-657786968 https://github.com/FirebaseExtended/flutterfire/issues/2582#issuecomment-658011068 https://github.com/FirebaseExtended/flutterfire/issues/2582#issuecomment-658152748
They are working on pre-release versions for other packages like firebase_auth
which supports the new core.
I have updated the cloud firestore version to the version ^0.14.0-dev.1 and firebase core to the version ^0.5.0-dev.2 and I have encountered problems executing this code that I have extracted from the documentation ->
// Initialize first await FirebaseCore.instance.initializeApp ();
// Set the host as soon as possible await FirebaseFirestore.instance .settings (Settings (host: "localhost: 8080", sslEnabled: false));
When initializing FirebaseCore it does not exist, however, Firebase.initializeApp () does exist.
Also, when making the settings, the error it gives is the following: 'The expression doesn't evaluate to a function, so it can't be invoked.' The example should look like this FirebaseFirestore.instance.settings = Settings (host: 'localhost: 8080', sslEnabled: false, persistenceEnabled: false); Also await is not necessary since it is not a Future.
@alejandroaap - Thanks for highlighting the error in the docs, we'll update it soon. The correct code should be:
// Initialize first
await Firebase.initializeApp();
// Set the host as soon as possible
FirebaseFirestore.instance.settings = Settings(host: "10.0.2.2", sslEnabled: false);
With that in mind, please be aware that at the time of writing, cloud_firestore >=0.14.0-dev.1
depends on firebase_core ^0.5.0-dev.1
, and firebase_auth 0.16.1
depends on firebase_core ^0.4.4
as per this issue
Hello @greghesp , today I have found new versions available. I am specifically using
firebase_core: ^ 0.5.0-dev.2 firebase_database: ^ 4.0.0-dev.1 cloud_firestore: ^ 0.14.0-dev.1 firebase_storage: ^ 4.0.0-dev.1 firebase_auth: ^ 0.17.0-dev.1
With these versions, the problem you are talking about no longer exists or at least I have not had it.
On the other hand, I have seen how FirebaseDatabase cannot be initialized with the firebase database emulator url. I have tried to initialize an instance with the url of the database emulator but nothing more than trying to get data, from that instance, the application closes and no error is displayed in the log. I understand that this error is still normal because the firebase database library has not been checked. Is that so?
@alejandroaap We've not touched Database yet, so nothing has changed other than upgrading internal dependencies. I'd suggest raising a new issue for this, so we don't clutter this issue. Thanks.
Hey everyone; another quick update;
The following pre-release versions are now live - these have all been updated to work with new Core:
Lots of work has gone into each of these plugins to improve testing & CI stability, these are now all using the latest Firebase SDKs and are also using the shared Firebase SDK versioning setup meaning all these plugins now depend on the same version of the Firebase SDKs - no longer mixing & matching versions.
If you can; please give these a try - overview pages for each of these are now showing on the docs site including a quick installation guide which shows what the latest pre-release version for each is, e.g. Analytics: https://firebase.flutter.dev/docs/analytics/overview.
Remote Config, Links, In App Messaging and Messaging pre-releases that use the new Core will be available soon.
@Salakar Great work ... but you neglected to mention Crashlytics ?
@Salakar Great work ... but you neglected to mention Crashlytics ?
For Crashlytics see https://github.com/FirebaseExtended/flutterfire/pull/2288#issuecomment-663170672
Remote Config with new firebase_core
(pre-rework) pre-release is up, also added in MacOS support whilst I was at it. 🙃
Amazing work!!!, just waiting for Messaging to Upgrade 😁
@Bilonik Amazing work!!!, just waiting for Messaging to Upgrade 😁
Just for you 😅 a Messaging pre-release has just been published that uses new Core 🙃
@Salakar As part of that cloud messaging rewrite, do you plan to implement the option to handle notifications with data once the application ends?
Hey all :wave:
Today I’m excited to announce the upcoming changes and roadmap for the FlutterFire plugins.
The overall mission of FlutterFire is to provide a set of high quality set of plugins for developers to allow them to build Flutter apps using Firebase. As Flutter grows, we want to ensure that the FlutterFire plugins grow with it, including Web support and enabling the possibility to support other platforms such as Desktop.
We’ve recently started a triage of repository issues to understand the current state of the repository, and get a feel for the biggest pain points and challenges developers are facing. The triage has enabled us to focus our efforts on bringing the library to production ready quality along with overall quality of life updates to FlutterFire.
Our top priorities are to introduce a dedicated documentation website, review each plugin in importance order (based on usage & current state) and tackle critical issues (such as slow Cloud Firestore build times).
As we review each plugin by group, we’ll be focusing efforts on the following areas:
Testing: covering the public API (as much as possible) with dedicated unit and integration tests is incredibly important to us, so we can be confident in adding new features, squashing bugs and opening up the repository to more external contributors.
Supporting Federated Plugins: we want to ensure that all plugins can be integrated with the platforms Flutter supports. Right now only 4 plugins are Federated (Core, Cloud Firestore, Analytics & Cloud Functions). As we move forwards, each plugin will be converted into a Federated setup to allow other platforms to integrate with FlutterFire.
Documentation: although the reference API is a great place to understand the plugins, the goal of FlutterFire is to allow developers of all backgrounds and experience to get up and running with as little friction as possible. We’ll be providing documentation on how to setup Firebase with your Flutter apps, get started with using each plugin within your app and guides on addressing how the plugins can integrate with the wider Flutter & Firebase ecosystems, helping to reduce the barrier to entry when working with the plugins.
As explained, we’ll be tackling the plugins in importance order. As it stands, the ordering is as follows:
Core
Status: complete, merged & stable release shipped.Cloud Firestore
Status: complete, merged & stable release shipped.Authentication
Status: complete, merged & stable release shipped.Crashlytics
Status: complete, merged & stable release shipped.Cloud Storage
Status: complete, merged & stable release shipped.Cloud Functions
Status: complete, merged & stable release shipped.Cloud Messaging (FCM)
Status: complete, merged & stable release shipped.We’ve yet to decide on the order of the remaining plugins, we’ll update you as we progress. Also, the Google team are heavily engaged with the AdMob plugin and will continue to maintain that as a top priority in parallel with this work.
We want to ensure that all plugins are interoperable as we work through them, allowing developers to see the benefits from the on-going work as soon as they are available. Therefore we’ll be doing some immediate changes across the board which will allow the newly updated plugins to be “backwards compatible” with plugins that have not yet been updated as part of this process.
To achieve this, we’ll be updating all FlutterFire plugins with the following top level changes:
Dependency on Core: The most significant change is to configure every plugin to have a hard dependency on
firebase_core
. This will both help reduce installation steps, improve API consistency and follow conventions of the Firebase SDKs.Fixed Firebase SDK versioning: all plugins will be set to a fixed version of the underlying Firebase SDK (however will be overridable if desired), allowing us to be confident developers will be using the same SDK versions we’ve tested against.
Consistent public API: developers coming from other platforms should be familiar with the public API FlutterFire offers, so we’ll work on bringing the API in-line with the Firebase APIs (where possible). See the Dart design style guide to learn more.
Reducing installation steps: installing and getting started with FlutterFire should be as painless as possible. We’re working towards reducing the amount of manual setup steps required to integrate the plugins.
Adding missing features: the issue triage and API review has highlighted a number of missing features which will be implemented as part of the plugin updates. In general if the underlying platform Firebase SDK supports a feature cross-platform then so should FlutterFire.
These changes will introduce a number of breaking changes, though we’ll do our best to keep these to a minimum and ensure that the documentation provides full change logs & migration guides to help make the upgrade as painless as possible.
We’ll be updating this issue as we progress through the upgrade to the plugins so please check back regularly.
The following GitHub users will primarily be focusing on this work going forwards:
If you have any urgent issues / pull requests that you feel you would like us to look at sooner - feel free to tag us in using the @FirebaseExtended/invertase GitHub team and we'll try our best to look at them as soon as possible.
Flutter blog post announcement: Flutter Package Ecosystem Update
If you're on Twitter, we'll be tweeting regular updates on the
@FlutterFireDev
account - feel free to follow along there also.