ezbloc_flutter 0.1.0 copy "ezbloc_flutter: ^0.1.0" to clipboard
ezbloc_flutter: ^0.1.0 copied to clipboard

outdated

Making blocs easy again. A simplified library for the original bloc approach.

example/main.dart

// import 'package:ezbloc_flutter/ezbloc_flutter.dart';
// import 'package:path_provider/path_provider.dart' as paths;
// import 'package:flutter/material.dart';
//
// class CounterBloc extends AutoPersistedBloc<CounterBloc, int> {
//   final int counterNumber;
//
//   CounterBloc({this.counterNumber}) : super(initialState: 0);
//
//   void increment() => setState(value + 1, event: 'increment');
//
//   void decrement() => setState(value - 1, event: 'decrement');
// }
//
// class MyApp extends StatelessWidget {
//   @override
//   Widget build(BuildContext context) {
//     final bloc = BlocContainer.get<CounterBloc>();
//
//     return MaterialApp(
//       home: Scaffold(
//         body: Center(
//           child: Column(
//             mainAxisAlignment: MainAxisAlignment.center,
//             children: [
//               Text('You have pushed the button this many times:'),
//               bloc.builder(
//                 onUpdate: (context, data) => Text(data.toString(), style: Theme.of(context).textTheme.headline4),
//                 onBusy: (_) => Text('Working'),
//                 onError: (_, e) => Text('Error Occurred'),
//               ),
//             ],
//           ),
//         ),
//         floatingActionButton: FloatingActionButton(
//           child: Icon(Icons.add),
//           onPressed: bloc.increment,
//         ),
//       ),
//     );
//   }
// }
//
// void main() async {
//   final documentsDir = (await paths.getApplicationDocumentsDirectory()).path;
//   HivePersistenceService.databaseDirectory = documentsDir;
//   BlocContainer.add<CounterBloc>((context, arg) => CounterBloc(counterNumber: arg ?? 0));
//   runApp(MyApp());
// }
2
likes
0
pub points
40%
popularity

Publisher

verified publishermuha.dev

Making blocs easy again. A simplified library for the original bloc approach.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

ezbloc, flutter, hive, path, quick_log, rxdart, synchronized

More

Packages that depend on ezbloc_flutter