Add comment explain dispatchEvent override (#60734)

This commit is contained in:
Ming Lyu (CareF) 2020-07-08 18:37:33 -04:00 committed by GitHub
parent 80b5ee4e7c
commit a5fa083906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -467,6 +467,11 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
HitTestResult hitTestResult, {
TestBindingEventSource source = TestBindingEventSource.device,
}) {
// This override disables calling this method from base class
// [GestureBinding] when the runtime type is [TestWidgetsFlutterBinding],
// while enables sub class [LiveTestWidgetsFlutterBinding] to override
// this behavior and use this argument to determine the souce of the event
// especially when the test app is running on a device.
assert(source == TestBindingEventSource.test);
super.dispatchEvent(event, hitTestResult);
}