dispatchEvent method

  1. @override
void dispatchEvent (PointerEvent event, HitTestResult result)
override

Dispatch an event to a hit test result's path.

This sends the given event to every HitTestTarget in the entries of the given HitTestResult, and catches exceptions that any of the handlers might throw. The result argument must not be null.

Implementation

@override // from HitTestDispatcher
void dispatchEvent(PointerEvent event, HitTestResult result) {
  assert(!locked);
  assert(result != null);
  for (HitTestEntry entry in result.path) {
    try {
      entry.target.handleEvent(event, entry);
    } catch (exception, stack) {
      FlutterError.reportError(FlutterErrorDetailsForPointerEventDispatcher(
        exception: exception,
        stack: stack,
        library: 'gesture library',
        context: 'while dispatching a pointer event',
        event: event,
        hitTestEntry: entry,
        informationCollector: (StringBuffer information) {
          information.writeln('Event:');
          information.writeln('  $event');
          information.writeln('Target:');
          information.write('  ${entry.target}');
        }
      ));
    }
  }
}