emitAsFuture method

Future emitAsFuture(
  1. String event, [
  2. dynamic arg0,
  3. dynamic arg1,
  4. dynamic arg2,
  5. dynamic arg3,
  6. dynamic arg4,
  7. dynamic arg5,
])
inherited

This function triggers all the handlers currently listening to event and passes them data.

@param String event - The event to trigger @param args - The variable numbers of arguments to send to each handler @return Future

Implementation

Future<dynamic> emitAsFuture(String event,
    [arg0, arg1, arg2, arg3, arg4, arg5]) async {
  this._events[event]?.toList().forEach((Function func) async {
    return await callbackAsFuture(func, arg0, arg1, arg2, arg3, arg4, arg5);
  });
  this._eventsOnce.remove(event)?.forEach((Function func) async {
    return await callbackAsFuture(func, arg0, arg1, arg2, arg3, arg4, arg5);
  });
}