Sitemap
Ricky Rinaldy

Ricky Rinaldy

Software Engineer

Fast Track Flutter [Chapter-3]

Jan 16, 2023

--

State Management Bloc

Press enter or click to view image in full size

Section 0: Introduction

Stream

Basic Concept Stream

Press enter or click to view image in full size
illustration 1

river flows illustration = data flow.

ship illustration = data..

Get Ricky Rinaldy’s stories in your inbox

Join Medium for free to get updates from this writer.

yield = process of flowing data.

Explanation:

When we want to send ship(data), the ship(data) will pass through yield so that it can be sent ship(data) to the destination.

Press enter or click to view image in full size
illustration 2

Case: Counter Number with delay

The output will be auto-counted numbers from 0 to 10, with a delay

Cubit

Press enter or click to view image in full size
Cubit Architecture

Important: you need install package bloc & flutter_bloc

how to install package : https://bloclibrary.dev/#/gettingstarted

Basic Cubit

Cubit is a simple BLoC implementation, used to trigger state changes via ‘emit’

Case: Counter Number emit

Cubit Observer

We can observe all changes for a given Cubit by overriding:

  • onChange, for observing all changes output to the console.
  • onError, for handling all reported errors globally.

docs: https://bloclibrary.dev/#/coreconcepts?id=observing-a-cubit

add cubit observer

Section 1: Cubit

--

--