dispose method

Future<void> dispose()

Tears down the tester, stopping the Program and releasing resources.

Implementation

Future<void> dispose() async {
  if (_program != null) {
    _program!.quit();
    try {
      await _runFuture?.timeout(
        const Duration(seconds: 2),
        onTimeout: () {
          _program!.kill();
        },
      );
    } catch (_) {
      // Swallow errors during cleanup (e.g. ProgramCancelledError).
    }
  }
  _program = null;
  _app = null;
  _terminal = null;
  _runFuture = null;
}