onError method

StreamSubscription<Map<HostEventType, dynamic>> onError({
  1. required ErrorHandler handler,
})
inherited

Implementation

StreamSubscription<Map<HostEventType, dynamic>> onError({required handler}) {
  var subsription = h.eventStream.listen((event) {});
  subsription.onData((data) {
    if (data.containsKey(HostEventType.error)) {
      handler(error: ArgumentError(data.values.first));
    }
  });
  h.errorListenerHandlers
      .update(handler, (value) => subsription, ifAbsent: () => subsription);
  return subsription;
}