https://github.com/modulovalue/single_bloc_base
Platform agnostic Bloc interfaces + HookBloc for Dart and Flutter
https://github.com/modulovalue/single_bloc_base
Last synced: 2 months ago
JSON representation
Platform agnostic Bloc interfaces + HookBloc for Dart and Flutter
- Host: GitHub
- URL: https://github.com/modulovalue/single_bloc_base
- Owner: modulovalue
- License: mit
- Created: 2019-11-01T11:11:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-03T11:41:03.000Z (over 5 years ago)
- Last Synced: 2025-02-22T01:03:56.964Z (3 months ago)
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/single_bloc_base
- Size: 52.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# single_bloc_base
[](https://pub.dev/packages/extra_pedantic) [](https://travis-ci.com/modulovalue/single_bloc_base) [](https://codecov.io/gh/modulovalue/single_bloc_base) [](https://github.com/modulovalue/single_bloc_base/blob/master/LICENSE) [](https://pub.dartlang.org/packages/single_bloc_base) [](https://github.com/modulovalue/single_bloc_base) [](https://twitter.com/modulovalue) [](https://github.com/modulovalue)
Platform agnostic Bloc interfaces + HookBloc for Dart and Flutter
Provides interfaces for:
- Disposable Blocs:
```dart
class ExampleBloc implements BlocBase {
const ExampleBloc();@override
Future dispose() async {
}
}
```
- Initializable Objects:
```dart
class ExampleInit implements InitBase {
const ExampleInit();@override
Future init() async {
}
}
```
- Initializable Blocs:
```dart
class ExampleBlocWithInit implements InitBloc {
const ExampleBlocWithInit();@override
Future dispose() async {
}@override
Future init() async {
}
}
```
- Bagged Initializable Blocs
```dart
class ExampleBaggedBloc extends BaggedInitBloc {
ExampleBaggedBloc(Iterable blocs,
Iterable initializableBlocs) {
blocs.forEach(bagBloc);
initializableBlocs.forEach(bagState);
disposeLater(() => print("dispose me later"));
initLater(() => print("init me later"));
}
}
```
- Hook Blocs that give you the ability to schedule objects for disposal in one line during their initialization:
```dart
class ExampleHookBloc extends HookBloc {
final MyOtherBloc otherBloc = HookBloc.disposeBloc(MyOtherBloc());
}class MyOtherBloc extends BlocBase {
MyOtherBloc() {}@override
Future dispose() async {
print("MyOtherBloc dispose");
}
}
```