safeEmitAsFuture method
Implementation
Future<dynamic> safeEmitAsFuture(String event,
[Map<String, dynamic>? args]) async {
try {
final Completer<dynamic> completer = Completer<dynamic>();
Map<String, dynamic> _args = {
'callback': completer.complete,
'errback': completer.completeError,
...?args,
};
emitAsFuture(event, _args);
return completer.future;
} catch (error) {
_logger.error(
'safeEmitAsFuture() event listener threw an error [event:$event]:$error',
);
}
}