easystate 0.0.8 easystate: ^0.0.8 copied to clipboard
EasyState is the simplest and the easiest state management for Flutter.
Easystate #
EasyState easiest and simplest Flutter state manager library for beginners.
It is not the perfect state manager but will give you great understanding learn what state management is.
Installation #
Add EasyState to your pubspec.yaml file:
dependencies:
easystate:
then, import it
import 'package:get/get.dart';
Examples #
- Define your model
class CountModel extends EasyState {
int value = 0;
increase() {
value ++;
update();
}
}
CountModel countModel = CountModel();
- And consume it with
StreamBuidler
.
StreamBuilder(
stream: countModel.stream,
builder: (context, snapshot) => Text(
snapshot.data != null ? snapshot.data.value.toString() : '0',
style: Theme.of(context).textTheme.headline4,
),
),
Reference #
- See Easystate Sample App for example.