Git Product home page Git Product logo

multiple-counters-flutter's Introduction

Flutter State Management

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:

Supported tasks:

  • Show a list of counters
  • Add new counters
  • Increment or decrement existing counters
  • Remove counters (swipe left to dismiss)

Database

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 database.dart class).

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.

State management

The same functionality is replicated in four different pages accessible via the bottom navigation bar, using different state management techniques:

Running the project

You need to register the project with your own Firebase account.

  • Use com.musevisions.multipleCountersFlutter as your bundle / application ID when generating the Firebase project.

  • Download the ios/Runner/GoogleService-Info.plist and android/app/google-services.json files as needed.

For more articles and video tutorials, check out Coding With Flutter.

multiple-counters-flutter's People

Contributors

bizz84 avatar

Watchers

James Cloos avatar Daniel Henrique avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.