Blocs

EZ Flutter has some buildin Blocs that can be used inside you app.

Basics

EZ Flutter offers the following blocs :

Usage

Access Blocs

Access each Bloc via the EzGlobalBloc using the get method. The get method uses the runtime type of the class.

EzBlocProvider.of(context).get(EzMessageBloc);

Add custom Blocs

Typically your app will use some blocs written by yourself. EZ Flutter supports adding custom blocs to the EzGlobalBloc. The EzRunner will add the given blocs to the EzGlobalBloc at startup. You can access each bloc everywhere inside the app.

Map blocs = {
  MyCustomBloc, MyCustomBloc()
}

void main(){
  EzRunner.run(MyHomePage(title: 'Hello EZ'), blocs : blocs);
}

Your Bloc has to extend EzBlocBase.

class MyCustomBloc extends EzBlocBase {
  // some stuff
}