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

example/example.dart

import 'dart:async';

import 'package:autoclose_bloc/autoclose_bloc.dart';
import 'package:bloc/bloc.dart';

part 'example_rest.dart';

class ProfileEditingFormBloc
    extends Bloc<ProfileEditingFormEvent, ProfileEditingFormState>
    with CloserBloc {
  final UserRepository userRepository;

  ProfileEditingFormBloc(
    super.initialState, {
    required this.userRepository,
  }) {
    on<ProfileFetchRenewedUserData>((event, emit) => {
          // ...
        });
    // ... other events

    userRepository.userAuthTokenStream.listen((token) {
      add(ProfileFetchRenewedUserData(token: token));
    }).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