autoclose_bloc 1.0.4
autoclose_bloc: ^1.0.4 copied to clipboard
autoclose_bloc is a package providing AutoClose functionality for the Bloc
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);
}
}