withPointerEventSource method Null safety

  1. @protected
void withPointerEventSource(
  1. TestBindingEventSource source,
  2. VoidCallback task
)

Sets pointerEventSource to source, runs task, then resets source to the previous value.

Implementation

@protected
void withPointerEventSource(TestBindingEventSource source, VoidCallback task) {
  final TestBindingEventSource previousSource = _pointerEventSource;
  _pointerEventSource = source;
  try {
    task();
  } finally {
    _pointerEventSource = previousSource;
  }
}