Skip to content

modulovalue/single_bloc_base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

single_bloc_base

extra_pedantic on pub.dev Travis CI Codecov License Pub.dev Github Stars Twitter Follow GitHub Follow

Platform agnostic Bloc interfaces + HookBloc for Dart and Flutter

Provides interfaces for:

  • Disposable Blocs:
class ExampleBloc implements BlocBase {
  const ExampleBloc();

  @override
  Future<void> dispose() async {
  }
}
  • Initializable Objects:
class ExampleInit implements InitBase {
  const ExampleInit();

  @override
  Future<void> init() async {
  }
}
  • Initializable Blocs:
class ExampleBlocWithInit implements InitBloc {
  const ExampleBlocWithInit();

  @override
  Future<void> dispose() async {
  }

  @override
  Future<void> init() async {
  }
}
  • Bagged Initializable Blocs
class ExampleBaggedBloc extends BaggedInitBloc {
  ExampleBaggedBloc(Iterable<BlocBase> blocs,
      Iterable<InitializableBlocBase> 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:
class ExampleHookBloc extends HookBloc {
  final MyOtherBloc otherBloc = HookBloc.disposeBloc(MyOtherBloc());
}

class MyOtherBloc extends BlocBase {
  MyOtherBloc() {}

  @override
  Future<void> dispose() async {
    print("MyOtherBloc dispose");
  }
}

About

Platform agnostic Bloc interfaces + HookBloc for Dart and Flutter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published