dispose method

void dispose()

Restores the plugin instance that was active before this harness.

Harnesses disposed out of order leave the newest live one installed. The disposed instance's streams stay open so a call already in flight can still finish.

Implementation

void dispose() {
  if (!identical(AppIntentsPlatform.instance, _platform)) return;
  AppIntentsPlatform.instance = _previous;
  final previous = _previous;
  if (previous is MethodChannelAppIntents) {
    previous.attachMethodCallHandler();
  } else {
    // Nothing to hand the channel back to; leaving it on this harness
    // would let later calls reach handlers the test no longer owns.
    const MethodChannel(_channel).setMethodCallHandler(null);
  }
}