Giter VIP home page Giter VIP logo

fun_arch_todo_flutter's Introduction

fun_arch_todo_flutter

This repository contains a reference implementation of the Flutter state management architecture. It uses centralized application State managed by the Store. (Redux like approach but without reducers). It does not use BLoC or Provider patents.

Details

The app implementation adheres to the following principles:

  • AppState is the root of the application state.
  • Each object that is part of the state hierarchy (sub-state object) is immutable and implements a copyWith function.
  • If an initial state is required for initialization, an initial() factory method is provided by the class.
  • null values are not allowed for the properties of the state/sub-state objects. If a value can be null, Maybe type is used.
  • AppStore is the container of the AppState it is globally accessible and exposes:
    • state - current version of the app state
    • state$ - Observable<AppState> - representation of the state changes over time
    • dispath(ActionFunction)
  • State can be modified by calling Store.dispatch(...) function passing Action as a parameter
  • There are two reference implementations of the Actions 1) as a regular Classs (ActionClass) that implements updateState AppState->AppState that returns modified version of the state.
  • Actions are always synchronous and used only to modify the state/sub-state.
  • For asynchronous functionality of fetching and manipulating the data a special Fettcher service is used.
    • Fetcher methods are responsible for calling Store::dispatch(...) method before (if needed) and after fetching and preparing the data to update the state.
    • Fetcher methods return Future<> to allow the caller of the fetch methods (usually UI components) to handle success or failure of the fetch calls to make "Navigation Decisions".
  • ConnectState widget is used to control the rendering (build(..)) of the UI Components (Widgets) by subscribing to changes of the parts of the AppState relevant to the Component.

fun_arch_todo_flutter's People

Contributors

bormind avatar cver22 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.