Giter Club home page Giter Club logo

Comments (1)

tenhobi avatar tenhobi commented on June 13, 2024

Because our source is a video and we do not wanna go through it over and over again, I did some screenshots as shown below.

Basically, to get this to work, we "only" have to separate UIs and business logic. If some platform dependent API is needed, it should be passed as a parameter and the API should be derivation of API's interface.

On the UI side, all inputs and outputs are provided through the business logic. Because Flutter app needs to be reloaded on each change in order to redraw, it's a good idea to use StreamBulder, in Angular, there is | async pipe.

The business logic therefore uses inputs (Sink), works with (platform dependent) APIs and generates some outputs (Stream).


Image 1
screenshot_1

Image 2
screenshot_2

Image 3
screenshot_3

Image 4
screenshot_4

Image 5
screenshot_5

Image 6
screenshot_6

To ensure everything will work good, the developers must strictly follow "aggressively pedantic rules":

  1. Inputs and outputs are simple Streams/Sinks only
  2. Dependencies must be injectable and platform agnostic
  3. No platform branching allowed
  4. Implementation can be whatever you want if you follow the previous rules

And of course, not everything has to have its own BLoC, only "complex enough" component should have one:

  1. Each "complex enough" component has a corresponding BLoC
  2. Components should send inputs "as is"
  3. Components should show outputs as close as possible to "as is"
  4. All branching should be based on simple BLoC boolean outputs

TL;DR:

  1. Move bussiness logic to BLoCs
  2. Keep UI components simple
  3. Design rules aren't negotiable

I think this is a quite good way and it worth a try. As an output of this project, we may do some review of this BLoC.

from flashcards.

Related Issues (20)

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.