dispatchEvent method Null safety
- PointerEvent event,
- HitTestResult? hitTestResult
override
Dispatch an event to pointerRouter and the path of a hit test result.
The event
is routed to pointerRouter. If the hitTestResult
is not
null, the event is also sent to every HitTestTarget in the entries of the
given HitTestResult. Any exceptions from the handlers are caught.
The hitTestResult
argument may only be null for PointerAddedEvents or
PointerRemovedEvents.
Implementation
@override
void dispatchEvent(PointerEvent event, HitTestResult? hitTestResult) {
switch (pointerEventSource) {
case TestBindingEventSource.test:
super.dispatchEvent(event, hitTestResult);
break;
case TestBindingEventSource.device:
assert(hitTestResult != null || event is PointerAddedEvent || event is PointerRemovedEvent);
assert(deviceEventDispatcher != null);
if (hitTestResult != null) {
deviceEventDispatcher!.dispatchEvent(event, hitTestResult);
}
break;
}
}