on method
- @Deprecated('Will be removed because of deprecation of `doFuture`')
- WidgetModel listener, {
- void onError(
- Object error
Do future on specified listener
await Future.value("wow").on(wm).then(result.add);
await Future.value("rly").on(wm).then(result.add);
Implementation
@Deprecated('Will be removed because of deprecation of `doFuture`')
Future<T> on(
WidgetModel listener, {
void Function(Object error)? onError,
}) {
final completer = Completer<T>();
listener.doFuture<T>(
this,
completer.complete,
onError: (e) {
onError?.call(e);
completer.completeError(e);
},
);
return completer.future;
}