veilidchat/lib/tools/bloc_tools.dart
2024-02-20 17:57:05 -05:00

13 lines
370 B
Dart

import 'package:bloc/bloc.dart';
mixin BlocTools<State> on BlocBase<State> {
void withStateListen(void Function(State event)? onData,
{Function? onError, void Function()? onDone, bool? cancelOnError}) {
if (onData != null) {
onData(state);
}
stream.listen(onData,
onError: onError, onDone: onDone, cancelOnError: cancelOnError);
}
}