builders

Creator: coderz1093

Last updated:

0 purchases

builders Image
builders Images

Languages

Categories

Add to Cart

Description:

builders

builders #
Use Consumer, Select and BlocConsumer in any System Injector
How Install #
Open your project's pubspec.yaml and add flutter_modular as a dependency:
dependencies:
builders: any
copied to clipboard
You can also provide the git repository as source instead, to try out the newest features and fixes:
dependencies:
builders:
git:
url: https://github.com/Flutterando/builders
copied to clipboard
Configure your System Injector #
You can use any System Injector for example Modular or Get_it.
main(){

//using Modular
Builders.systemInjector(Modular.get);

//using Get_it
Builders.systemInjector(GetIt.I.get);

runApp(YourAmazingApp());
}
copied to clipboard
Using in your Flutter App #
Here are some Builders known to the community. Here we have Consumer and Selector (Originally from the Provider package) and BlocConsumer, (from the flutter_bloc package)
Consumer #
Consumer is used when you want to listen to a class that extends from ChangeNotifier:
class MyCounter extends ChangeNotifier {

int value;

increment() {
value++;
notifyListeners();
}

}
copied to clipboard
in your View:
Consumer<MyCounter>(
builder: (context, myCounter){
return Text('${myCounter.value}');
}
);
copied to clipboard
Selector #
Selector works like Consumers, however you can select and listen to only one property of your Object.
Selector<MyCounter, int>(
selector: (myCounter) => myCounter.value,
builder: (context, value){
return Text('$value');
}
);
copied to clipboard
BlocConsumer #
Listen to custom streams from the bloc package (Bloc and Cubit).
class MyCounterBloc extends Cubit<int> {

MyCounterBloc(): super(0);

increment() => emit(state + 1);

}
copied to clipboard
in your View:
BlocConsumer<MyCounterBloc, int>(
builder: (context, state){
return Text('$state');
}
);
copied to clipboard
Features and bugs #
Please send feature requests and bugs at the issue tracker.
This README was created based on templates made available by Stagehand under a BSD-style license.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.