a bloc wrapper package
realank_flutter_bloc contains 3 classes:
RLKBaseBLoC:a BLoC data that can store any type of data
RLKBLoCProvider:the root widget of whose widgets need to use RLKBaseBLoC's data
RLKBLoCBuilder:a RLKBaseBLoC getter
class CountBLoC extends RLKBaseBLoC<int> {
CountBLoC(int data) : super(data);
increment() {
changeData(data + 1);
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RLKBLoCProvider(
bloc: CountBLoC(0),
child: MaterialApp(
theme: ThemeData.light(),
home: TopPage(),
),
);
}
}
RLKBLoCBuilder(builder: (BuildContext context, int data, RLKBaseBLoC bloc) {
return Text(
'You hit me: $data times',
style: Theme.of(context).textTheme.display1,
);
})
For help getting started with Flutter, view our online documentation.
For help on editing package code, view the documentation.