value_bloc 1.1.0 copy "value_bloc: ^1.1.0" to clipboard
value_bloc: ^1.1.0 copied to clipboard

discontinued

A predictable state management library that helps implement a fetch data from database or another storage

value_bloc #

GitHub pub.dev
value_bloc value_bloc
flutter_value_bloc flutter_value_bloc

Getting Started #

You can find many cubits that are right for you.

Modular cubits #

You can integrate modules into your cubits

LoadCubitModule

For example you can mix LoadCubitModule to integrate a load function

class MyCubit extends ModularCubit<State> with LoadCubitModule {
  void onLoading() {
    // write your code for initializing bloc
    emitLoading();
  }
}

Local Value/s cubits

Cubit as: ValueCubit, ListCubit, SetCubit is recommended to use as described below

class MyCubit extends Cubit<State> {
  final userCubit = ValueCubit<User, Object>();
  
  MyCubit() {
    userCubit.updateValue(value: User('Piero'));
  }
}

Fetch Value/s cubits

Cubist as: SingleCubit and MultiCubit is recommended to use as described below

class MyCubit extends Cubit<State> {
  final userCubit = SingleCubit<User, Filter, Object>();
  
  MyCubit() {
    userCubit.fetcher(fetcher: _fetcher);
  }
  
  _fetcher(Filter filter) async* {
    if (filter == Filter.empty) {
      yield SingleFetchEvent.empty();
    } else {
      yield SingleFetchEvent.fetched(User('Piero'));
    }
  }
}
2
likes
80
pub points
0%
popularity

Publisher

unverified uploader

A predictable state management library that helps implement a fetch data from database or another storage

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

bloc, built_collection, built_value, collection, dartz, equatable, pure_extensions, quiver, rxdart

More

Packages that depend on value_bloc