Code Monkey home page Code Monkey logo

blocs's Introduction

Reactive Programming - BLoC - Practical Use Cases and Patterns

Source code of the article available on didierboelens.com

This article introduces some practical use cases of the BLoC pattern:

  • Event-State

    Sometimes, handling a series of activities which might be sequential or parallel, long or short, synchronous or asynchronous and which could also lead to various results, can become extremely hard to program. You might also require to update the display along with the progress or depending on the states.

    This first use case is aimed at making it easier to handle such situation.

  • Form Validation

    How to make it easier to automate a Form fields content validation and Widgets accessibility, based on Business Rules?

    This second use case shows how to achieve this, separating the business rules from the View.

    As a bonus, it also shows how to answer a question very frequently asked: "how to check if a password and retyped password match?".

  • Part Of

    This last use case explains how easy it is, thanks to the BLoC pattern, to make an isolated Widget behavior adapt based on its presence in a set.

    The source code, through a embryo of a Shopping Basket application, shows how a Widget knows it is part of the Shopping Basket or not, and how it can adapt its behavior accordingly.


Updated (20 DEC 2018)

  • Code clean up

  • Additional version of the "DecisionPage" (see decision_page_no_business.dart) This version of the page does not contain any Business Logic but externalizes the Business Logic via the [DecisionStateTransform] which extends the [BlocStateTransformBase]

blocs's People

Contributors

boeledi avatar

Watchers

James Cloos 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.