Happy paths recommendations

Ads Ads happy path image

Are you looking to monetize your mobile app? You can do that by adding in-app ads using the google_mobile_ads package. You’ll need to register a free account with AdMob and you can then leverage one or more AdMob features, including the following:

  • Several ad formats: Banner, full-screen, native, and rewarded.
  • Control over when ads display. For example, in between levels of a game, after completing a task, or before starting a new game
  • Monetization reports to help you make decisions about your app.

Background processing Background processing happy path image

The background processing path shows you how to run a Dart function in the background on mobile devices. With background processing, you can perform tasks like making an HTTP request, running an expensive calculation, or displaying a notification in another isolate (similar to a lightweight thread).

There are a of couple ways to incorporate background processing into your mobile app. One way is through a Dart isolate. With a Dart isolate, you can create a separate thread to run tasks concurrently in the background.

Another way to incorporate background processing is through the WorkManager plugin. With this plugin, you can enable persistent headless execution of Dart code. Your tasks remain scheduled through app restarts and system reboots.

Some features of WorkManager include:

  • Persistent work handling
  • Flexible scheduling
  • Ability to apply constraints on jobs like checking for a network connection, only running when the device is charging, or only running when a device is idle (Android only)

Geolocation Geolocation happy path image

Geolocation, the ability to determine where in the world a user is located, is critical functionality for many applications; for example, shopping apps need to calculate shipping, fitness apps need to track distance traveled, and so on. The plugins in Flutter’s ecosystem offer a number of features to help build these experiences.

A plugin that provides this functionality is the geolocator plugin, rated as a Flutter favorite. With this plugin, you can check and request permission, fetch a one-time location, and even provide a stream of constantly updated values as a user moves about.

Features include:

  • Ability to get a device’s current location
  • Receive location updates
  • Ability to determine whether a devices’s location services are enabled

Immutable data Immutable data happy path image

For an easy way to represent immutable application data, check out two plugins that provide ways to handle and manipulate immutable data: freezed and json_serializable, both rated as Flutter favorites.

These plugins can be used independently, but are also great when used together. The freezed package handles in-memory objects and json_serializable maps those immutable objects to and from the JSON format.

Structured local storage Structured local storage happy path image

Structured local storage increases app performance and improves the user experience by selectively saving expensive or slow data on a user’s device. This path suggests two plugins for local persistence: drift and hive. Which plugin you choose depends on your needs.

Drift, rated a Flutter favorite, offers a fully-typed object relational mapping (ORM) around SQLite, with support on all Flutter platforms. Developers who require a fully relational database on their users’ device will benefit most from this package.

Hive offers a fully-typed object document mapping (ODM) around a custom storage solution, with support on all Flutter platforms. Developers who do not require a fully relational database, especially if they use document-based storage on their server (like Cloud Firestore) will benefit most from this package.

Web sockets Web Sockets Happy path image

Web sockets enable communication between Flutter clients and servers. This path suggests two packages to use when installing and using web sockets.

Use the web_socket_channel package for client-side web socket connections, and the web_socket_connections package for server-side Dart web sockets.