handlePointerEventForSource method
- PointerEvent event, {
- TestBindingEventSource source = TestBindingEventSource.device,
Dispatch an event to the targets found by a hit test on its position, and remember its source as pointerEventSource.
This method sets pointerEventSource to source
, forwards the call to
handlePointerEvent, then resets pointerEventSource to the previous
value.
If source
is TestBindingEventSource.device, then the event
is based
in the global coordinate space (for definitions for coordinate spaces,
see TestWidgetsFlutterBinding) and the event is likely triggered by the
user physically interacting with the screen during a live test on a real
device (see LiveTestWidgetsFlutterBinding).
If source
is TestBindingEventSource.test, then the event
is based
in the local coordinate space and the event is likely triggered by
programmatically simulated pointer events, such as:
- WidgetController.tap and alike methods, as well as directly using TestGesture. They are usually used in AutomatedTestWidgetsFlutterBinding but sometimes in live tests too.
- WidgetController.timedDrag and alike methods. They are usually used in macrobenchmarks.
Implementation
void handlePointerEventForSource(
PointerEvent event, {
TestBindingEventSource source = TestBindingEventSource.device,
}) {
withPointerEventSource(source, () => handlePointerEvent(event));
}