realank_flutter_bloc 0.1.1 copy "realank_flutter_bloc: ^0.1.1" to clipboard
realank_flutter_bloc: ^0.1.1 copied to clipboard

outdated

a bloc wrapper package, you can use BLoC(Business Logic Component). pattern easily

realank_flutter_bloc #

Build Status License: MIT

a bloc wrapper package

Introduce #

relank_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

example #

1. extends RLKBaseBLoC to add custom operation (optional)

class CountBLoC extends RLKBaseBLoC<int> {
  CountBLoC(int data) : super(data);
  increment() {
    changeData(data + 1);
  }
}

2. wrap root widget with RLKBloCProvider, and pass a RLKBaseBLoC instance

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return RLKBloCProvider(
      bloc: CountBLoC(0),
      child: MaterialApp(
        theme: ThemeData.light(),
        home: TopPage(),
      ),
    );
  }
}

3. use RLKBLoCBuilder to get RLKBaseBLoC and it's data anywhere

RLKBLoCBuilder(builder: (BuildContext context, int data, RLKBaseBLoC bloc) {
        return Text(
          'You hit me: $data times',
          style: Theme.of(context).textTheme.display1,
        );
      })

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

a bloc wrapper package, you can use BLoC(Business Logic Component). pattern easily

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on realank_flutter_bloc