This is a sample app showing four different approaches to managing state in Flutter:
Use case: manage multiple counters, synced with Firebase Database.
Watch my video for a full overview of the differences and tradeoffs between these techniques:
The app uses Firebase as a source of truth for the state of the counters. This allows the data to be easily synced across multiple clients. Realtime Database and Cloud Firestore are both supported (see
NOTE: For simplicity, the whole database has public read/write access, and counters can't be set per-user. For a production app it would be more appropriate to set user access rules.
The same functionality is replicated in four different pages accessible via the bottom navigation bar, using different state management techniques:
You need to register the project with your own Firebase account.
com.musevisions.multipleCountersFlutter as your bundle / application ID when generating the Firebase project.
android/app/google-services.json files as needed.