voyager_bloc 0.1.0 voyager_bloc: ^0.1.0 copied to clipboard
A BLoC plugin for Voyager. Allows describing Bloc's initial state in YAML config.
voyager_bloc #
A new Flutter package project.
Class Hierarchy & Bloc Plugin Builder #
Flutter Dart has no reflection and runtimeType
doesn't contain information about parent classes, therefore voyager bloc plugin builder has specific API to address this issue:
If your bloc class (e.g. ParentBloc
) is extending directly from Bloc
use:
addBaseBloc<ParentBloc>((routeContext, config, repository) {
return ParentBloc();
})
If your bloc doesn't extend directly from Bloc
but e.g. from ParentBloc
you will want to use:
addBloc<ChildBloc, ParentBloc>((routeContext, config, repository) {
return ChildBloc();
})