mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-01-06 13:27:52 -05:00
13 lines
370 B
Dart
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);
|
||
|
}
|
||
|
}
|