autoclose_bloc 1.0.5 copy "autoclose_bloc: ^1.0.5" to clipboard
autoclose_bloc: ^1.0.5 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 #

flutter pub add autoclose_bloc
# optional, but I insist on giving it a chance
flutter pub add autoclose_lint

Usage #

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

  final UserRepository userRepository;

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

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

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

autoclose_bloc is a package providing AutoClose functionality for the Bloc

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

autoclose_flutter, bloc, flutter

More

Packages that depend on autoclose_bloc