Along with the awesome Flutter and Firebase announcements made during Google I/O, the Invertase team is excited to announce the latest round of updates for the FlutterFire plugins.
Firebase SDK upgrades #
The Firebase SDK versions used by FlutterFire plugins have been updated to the new versions released for Google I/O:
- iOS now uses Firebase iOS 8.0.0 (changelog)
- Android now uses Firebase Android BoM 28.0.1 (changelog)
- Web now uses Firebase JS 8.6.1 (changelog)
Upgrading the web SDK #
Upgrading Firebase plugins will not automatically upgrade the web SDK version that your application uses. You will have to manually upgrade your
If you're not on the correct version of the Firebase JS SDK FlutterFire will now print a detailed warning about it during debug.
New plugin: Firebase App Check #
A new exciting plugin was added to the FlutterFire family:
App Check helps protect your backend resources (such as Cloud Storage) from abuse (such as billing fraud or phishing).
With App Check, devices running your app will use an app identity attestation provider to certify it is indeed your authentic app, and may also check that it’s running on an authentic, untampered device. This certification is attached to every request your app makes to your Firebase backend resources.
App Check currently supports Cloud Storage, Realtime Database, and Cloud Functions, with more Firebase products coming soon. See the Firebase documentation about App Check for more information.
Firebase Messaging: checking for browser support #
firebase_messaging 10.0.0, support was added for checking if the browser your application is running on supports Firebase Messaging.
This can be done with:
This is equivalent to the API of the same name on the Firebase JS SDK.
Cloud Firestore: improving type-safety #
With the release of cloud_firestore 2.0.0, withConverter was added on numerous classes.
This method help developers manipulate Firestore data in a type-safe way, by making read and write operations use a custom Dart class instead of a
As an example, consider a collection of movies:
One limitation with this syntax is, if we want to interact with this collection in any way, we will have to use
Map. The downside is, as applications grow larger, this becomes error-prone. For example, nothing prevents us from doing:
withConverter, we could instead define our collection as:
This changes the prototype of methods like get, set and snapshots to use a Movie instance instead of
Map. A side-effect is that our previous mistake is no longer feasible:
Cloud Firestore: data bundles #
Firebase has recently introduced a neat new feature to Firestore called "data bundles" which can be read in-depth here. In a nutshell, it allows users to cache data snapshots with the intention of saving costs and decreasing app load-up speed. The FlutterFire Firestore package has recently updated its own API to include a handy method called
loadBundle() to load these cached bundles. Here is an example of it in action:
Cloud Firestore additionally supports named queries for data bundles. To learn how to name a query when creating your data bundle, read here. The FlutterFire Firestore package has added
namedQueryGet() as an easy way to retrieve this data by name from Firestore cache. Here's how that would look:
Cloud Storage: local emulator support #
A Firebase Storage emulator was just announced at Google I/O that allows users to test their application's Firebase Storage surface area quickly, locally, and without incurring Firebase Server costs. FlutterFire already supports connecting to the emulator in its latest release.
To begin, you must first set up the Firebase Storage emulator which can be read about here. The next step is to connect to the emulator via the FlutterFire Storage package by the following setup:
A new codelab for Flutter + Firebase was added: Get to know Firebase for Flutter.
Make sure to check it out to learn more about Firebase for Flutter!
Tune in to the "Get to know Firebase for Flutter Google I/O workshop" for more on this.
Flutter Favorite program #
The following FlutterFire plugins are now part of the Flutter Favorite program:
For a package to become a Flutter Favorite it needs to have passed several quality metrics and meet some high quality standards. This is great news for FlutterFire and shows the quality of work and level of commitment we've put into these packages over the past year.
That's it for today. Have a great Google I/O 2021!