autoclose_bloc 1.0.0
autoclose_bloc: ^1.0.0 copied to clipboard
autoclose_bloc is a package providing AutoClose functionality for the Bloc
example/example.dart
import 'package:autoclose_bloc/closer/closer_bloc.dart';
import 'package:bloc/bloc.dart';
class ProfileEditingFormBloc
extends Bloc<ProfileEditingFormEvent, ProfileEditingFormState>
with CloserBloc {
final UserRepository userRepository;
ProfileEditingFormBloc({
required this.userRepository,
}) {
on<ProfileFetchRenewedUserData>(_onProfileFetchRenewedUserData);
// ... other events
userRepository.userAuthTokenStream.listen((token) {
add(ProfileFetchRenewedUserData(token: token));
}).closeWith(this);
}
}