March 2023: Diving into Riverpod, Realm Flutter SDK, FFIgen and JNIgen tutorials

Since the release of Flutter 3.7 and all the new stuff announced at Flutter Forward, things have calmed down a little.

But a few new developments have been brewing in the Flutter ecosystem.

And as usual, I’m here to cover all the latest news! 👇

Flutter Livestreams

As you know, the official Flutter YouTube channel is a great place to learn and stay up to date.

But did you know that it also hosts a growing collection of livestreams (branded as “Observable Flutter”), covering many different topics in great depth?

Here are the top ones from the last month. 👇

📹 Observable Flutter: Diving into Riverpod, with Rémi Rousselet

Undoubtedly, Riverpod continues to win the minds and hearts of many Flutter developers.

And Remi recently announced that he’d focus on improving the docs and “consolidating the Riverpod experience instead of adding new features” in the coming months.

This is welcome news. And while we wait for the updated documentation, this new video offers a great overview of what modern app development with Riverpod looks like:

📹 Observable Flutter: MongoDB & Realm

When it comes to offline-first data persistence, we are spoilt for choice thanks to packages like Drift, ObjectBox, and Isar.

But if you want to build offline-first apps that can also sync data with a remote database, your options are more limited.

So it’s great to see that MongoDB has entered this space by publishing the official Realm SDK for Flutter.

And this livestream shows how to build an offline-first, data-syncing mobile app with Flutter, Realm, and MongoDB:

Or, if you want a quick summary, read the official announcement:

Other Flutter Videos

In addition to the livestreams above, new videos have been added to the “Widget of the Week” and “Package of the Week” playlists. 👇

📹 RawMagnifier (Widget of the Week)

If you ever wanted to add a magnifier effect to your apps (and make it easier to read small text), your wish has just been granted.

With the new RawMagnifier widget, we can show a platform-specific magnifier when dragging over an element in the app.

We can use the RawMagnifier widget by placing a GestureDetector inside a Stack, save position details on drag, and enable or disable it. Then we can customize various visual properties, and even change its shape or add borders with the MagnifierDecoration class:

📹 flutter_lints (Package of the Week)

Every time you create a new Flutter app, the flutter_lints package is added by default.

This includes a collection of lint rules that help you follow best practices.

Many lint rules come with predefined fixes. When available, run dart fix --apply or apply the quick fix in your IDE, and Dart will automatically fix up your code so that it follows best practices:

Other Flutter Articles

Alongside all the official resources, here are some interesting articles from the community. 👇

📝 Unlock the Magic of Pattern Matching in Dart 3.0

In the previous newsletter, I shared a video by the Flutter team about bringing pattern matching to Dart, and I can’t wait to start using Dart 3.0 in my apps.

Along the same lines, this article discusses how pattern matching can be used with Dart 3.0 to simplify code and streamline control flow, using examples such as JSON Destructuring, JSON Validation, enhanced switch cases with guards, logical and relational operators, and much more:

📝 FFIGen: An Easy Way to Access iOS Libraries

As part of the Flutter 3.7 release, new FFIgen and JNIgen tools were announced. These tools will allow us to generate code bindings and communicate directly with the iOS and Android APIs from Dart without using platform channels.

So here’s a handy step-by-step tutorial about FFIgen, showing how to integrate an audio player written in Swift into a Flutter app (source code is also included):

A similar tutorial is also available for JNIgen (the corresponding tool on Android):

Latest on Code with Andrea

Since the last edition, I have published a new article and updated older ones. 👇

📝 How to write Flutter apps faster with Riverpod Lint & Riverpod Snippets

With every new release, Riverpod and its ecosystem keep improving.

And the new Riverpod Lint package adds many useful lints and refactoring options that make writing Flutter apps a breeze. Here are all the details:

📝 How to Auto-Generate your Providers with Flutter Riverpod Generator (Updated)

Over the last month, Riverpod 2.3 and version 2.0 of the Riverpod Generator have been released.

The most notable improvement is the introduction of the new StreamNotifier class. But there are other improvements too, which I have covered in my (updated) articles:

🔥 Flutter & Firebase course: progress update

Back in January, I officially started work on my new Firebase course, which will launch for pre-sale next month.

And as of today, I have already recorded 3.5 hours of content:

Flutter & Firebase: course preview
Flutter & Firebase: course preview

I can't wait to launch the course and share it with you!

And for all the details, check out the official course page:

Until Next Time

Time flies, and we’re almost at the end of Q1.

And who knows what’s next? Maybe we’ll soon get a new stable release that will make Flutter apps more colorful! 🎨

And if you want to find out what other goodies are coming, check this page by the Flutter team with a list of notable commits.

Happy coding!

Want More?

Invest in yourself with my high-quality Flutter courses.

Flutter Foundations Course

Flutter Foundations Course

Learn about State Management, App Architecture, Navigation, Testing, and much more by building a Flutter eCommerce app on iOS, Android, and web.

Flutter & Firebase Masterclass

Flutter & Firebase Masterclass

Learn about Firebase Auth, Cloud Firestore, Cloud Functions, Stripe payments, and much more by building a full-stack eCommerce app with Flutter & Firebase.

The Complete Dart Developer Guide

The Complete Dart Developer Guide

Learn Dart Programming in depth. Includes: basic to advanced topics, exercises, and projects. Fully updated to Dart 2.15.

Flutter Animations Masterclass

Flutter Animations Masterclass

Master Flutter animations and build a completely custom habit tracking application.