tearDown method Null safety

  1. @override
Future<void> tearDown(
  1. KeyDataTransitMode value,
  2. covariant KeyDataTransitMode? memento
)
override

A function that is guaranteed to be called after a value is tested, even if it throws an exception.

Calling this function must return the testing environment back to the base state it was in before setUp was called. The memento is the object returned from setUp when it was called.

Implementation

@override
Future<void> tearDown(KeyDataTransitMode value, KeyDataTransitMode? memento) async {
  // ignore: invalid_use_of_visible_for_testing_member
  RawKeyboard.instance.clearKeysPressed();
  // ignore: invalid_use_of_visible_for_testing_member
  HardwareKeyboard.instance.clearState();
  // ignore: invalid_use_of_visible_for_testing_member
  ServicesBinding.instance.keyEventManager.clearState();
  debugKeyEventSimulatorTransitModeOverride = memento;
}