autoclose_bloc 1.0.2 copy "autoclose_bloc: ^1.0.2" to clipboard
autoclose_bloc: ^1.0.2 copied to clipboard

autoclose_bloc is a package providing AutoClose functionality for the Bloc

AutoClose-Bloc #

This is a part of AutoClose package: You should first visit this link to become familiar with the key concepts of this library..

This library provides functionality of AutoClose package for Bloc classes.

Getting started #

# required
flutter pub add autoclose 
# it is POSSIBLE to use without Flutter. Can't imagine why
flutter pub add autoclose_flutter
# optional, but I insist on giving it a chance
flutter pub add autoclose_lint
# this lib
flutter pub add autoclose_bloc

Usage #

class ProfileEditingFormBloc extends Bloc<ProfileEditingFormEvent, ProfileEditingFormState> 
  // add AutoCloseBloc mixin to your bloc either manualy
  // or by closer bloc assist (press `⌘.` in VS Code or `Alt+Enter` in IntelliJ Idea)
  with AutoCloseBloc {

  final UserRepository userRepository;

  ProfileEditingFormBloc({
    required this.userRepository,
  }) {
    on<ProfileFetchRenewedUserData>(_onProfileFetchRenewedUserData);
    // ... other events

    userRepository.userAuthTokenStream.listen((token) {
      add(ProfileFetchRenewedUserData(token: token));
    })
    // AutoCloseBloc mixin provides `closeWith` functionality for your Bloc classes
    .closeWith(this);
  }
}
0
likes
0
points
61
downloads

Publisher

unverified uploader

Weekly Downloads

autoclose_bloc is a package providing AutoClose functionality for the Bloc

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

autoclose, bloc

More

Packages that depend on autoclose_bloc