At Canonical, we love Flutter and we can’t stop talking about it. Our Flutter developers have been working on bringing support to desktop operating systems since July 2020.
This includes our new Ubuntu Desktop installer, built with Flutter, which will be the default user journey in our upcoming 22.04 LTS release. (If you want to see how it’s coming along you can test it out here.)
Continuing our Flutter journey, we recently partnered with Invertase to bring FlutterFire support to Desktop and Dart. In this blog post, we’ll go over what Flutter’s Firebase announcement means for desktop developers, how to get started with Flutter on Desktop, and where to go to keep an eye on this exciting project!
Okay, but what is FlutterFire?
FlutterFire is a set of official plugins that connect your Flutter application to various Firebase services. Firebase is a collection of tools that provide common services such as analytics, authentication, databases, and push messaging, amongst many other things.
These tools allow developers to leverage common functionality in their Flutter applications, saving development time and effort.
As part of Flutter 2.8, most of these Firebase plugins have now moved from Beta to Stable quality for Android, iOS, web and macOS platforms. This means developers can leverage these services across their target platforms with the confidence that they’ll all ‘just work’. This frees up time for them to focus on the things that make their app unique rather than re-implementing existing services.
You can read more about this work in the latest Flutter blog.
What about Linux and Windows?
This is where our partnership with Invertase comes in! Whilst macOS is similar enough to iOS to leverage the same Firebase iOS SDK, Windows and Linux have no SDK of their own.
And currently the Firebase C++ SDK only provides basic support for integration with Firebase.
Ultimately we want Flutter developers to have an end-to-end Dart experience across any platform and the Invertase team has risen to this challenge by developing a pure Dart SDK for Firebase. Right now this includes a Dart only initialisation flow along with a nifty command line tool to help with Firebase initialisation.
“We’re really excited to be working with Canonical, using our knowledge of Firebase & Flutter to build the Firebase integrations for Linux & Windows. Our long term vision is for FlutterFire to seamlessly integrate with all of the Flutter supported platforms.”Elliot Hesp, Invertase CEO
Currently the Invertase team are prioritising firebase_core, a prerequisite to initialise Firebase. This is followed by firebase_auth, which provides backend services to authenticate via third-party providers such as Facebook, Twitter, Github and Google, as well as bespoke account systems. You can view these features using the demo app provided in the next section!
How can desktop developers get started with Flutter?
Whilst support for Desktop is still in beta, Flutter developers can enable desktop support today via the following flutter config:
$ flutter config --enable-linux-desktop
For more information on the additional Linux requirements, check out the official documentation here.
In the meantime, the Invertase team have put together an example desktop app based on firebase_core and firebase_auth using the Ubuntu Yaru theme as a guideline for getting started with Firebase.
To get up and running with this app on Ubuntu, follow the instructions below:
$ snap install flutter --classic
$ flutter config --enable-linux-desktop
$ flutter doctor
If everything is OK, you should see something like this:
[✓] Linux toolchain - develop for Linux desktop
cURL, Node.js, and NPM:
$ sudo apt install curl nodejs npm
Firebase tools CLI:
$ curl -sL https://firebase.tools | bash
$ dart pub global activate melos
$ export PATH="$PATH:$HOME/.pub-cache/bin"
Get the source code
$ git clone https://github.com/invertase/flutterfire_desktop.git
$ cd flutterfire_desktop
Get Dart dependencies
$ melos bootstrap
Run the Firebase emulator
$ melos run firebase:emulator
$ xdg-open http://localhost:8080
Run the example
$ cd packages/firebase_auth/firebase_auth_desktop/example
$ flutter run -d linux
It should look something like this:
The community are also on Fire(base)!
One of the great things about FlutterFire Desktop is the involvement of the community. We wanted to take a brief moment to shout out Tim Whiting’s work on a dart implementation of cloud_functions, which has been a fantastic recent addition to the project!
Follow FlutterFire Desktop
The GitHub repository for FlutterFire Desktop can be found here.
Follow Invertase for updates on the Firebase Dart SDK.
Check out the Flutter Blog for all the latest news on Flutter.
Finally, don’t forget to keep an eye on the Ubuntu Desktop Discourse for progress on our new Installer, as well as various community Flutter initiatives including Yaru theming and an exploratory Ubuntu Settings App!
Learn how the Ubuntu desktop operating system powers millions of PCs and laptops around the world.
A modern user interface, improved configuration options and a celebration of the mission of Ubuntu Desktop, to make Linux accessible to all.
As 2023 draws to a close, it’s time to look back on the evolution of Ubuntu Desktop over the last twelve months.
Learn how Netplan has established itself as the proven network stack across all variants of Ubuntu – Server, Cloud, Embedded and now Desktop.