onHttp static method

StreamSubscription<HttpEvent> onHttp(
  1. void callback(
    1. HttpEvent
    ), {
  2. Function? onError,
})

Subscribes to HTTP sync events.

Implementation

static StreamSubscription<HttpEvent> onHttp(
  void Function(HttpEvent) callback, {
  Function? onError,
}) {
  return events
      .where((event) => event.type == EventType.http)
      .cast<GeolocationEvent<HttpEvent>>()
      .map((event) => event.data)
      .listen(callback, onError: onError);
}