flutter_service_bloc 3.0.4 copy "flutter_service_bloc: ^3.0.4" to clipboard
flutter_service_bloc: ^3.0.4 copied to clipboard

Flutter package for service layer implement with bloc architecture

flutter_service_bloc #

Flutter package for service layer implement with bloc architecture

Usage #

Bloc #

For bloc usage please ref to service_bloc.

Listener #

  • Dialog
ServiceBlocListener<ProductCheckoutServiceBloc, ProductCheckoutServiceRequested, String>(
  onLoading: (context, state, event) => showLoading(),
  onResponded: (context, state, event) => hideLoading(),
  onFailed: (context, state, event, error) => showErrorDialog(context, error),
),
  • Navigate
ServiceBlocListener<ProductCheckoutServiceBloc, ProductCheckoutServiceRequested, String>(
  onSucceed: (context, state, event, data) => Navigator.of(context).pushNamed(<your route>),
),
  • Bloc communication
ServiceBlocListener<UserLogoutServiceBloc, UserLogoutServiceRequested, dynamic>(
  onSucceed: (context, state, event, data) => context.read<UserCubit>().clearUserData(),
),

Builder #

ServiceBlocBuilder<OpenLibraryAuthorDetailServiceBloc, OpenLibraryAuthorDetailServiceRequested, OpenLibraryAuthorDetail>(
  onLoading: (context, state, event) => // your loading widget,
  onSucceed: (context, state, event, data) {
    return // your success widget
  },
  onFailed: (context, state, event, error) => // your failure widget,
),

For more example detail, please check out example.

Maintainer #

Jack Liu

1
likes
140
pub points
47%
popularity

Publisher

unverified uploader

Flutter package for service layer implement with bloc architecture

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_bloc, service_bloc

More

Packages that depend on flutter_service_bloc