onDetach method

  1. @override
void onDetach()
override

Called during pop before the future is completed. Override for cleanup that must happen before the exit animation.

Implementation

@override
void onDetach() {
  // A swipe-back (or any external pop) bypasses the Cancel button —
  // discard the session strokes exactly like Cancel, continuing the
  // fade from wherever the interactive revert left it.
  if (!_resolved) {
    _resolved = true;
    layer.restoreSnapshotAnimated().unawaited();
    _viewerAnimator.animate(target: CameraFit.identity).unawaited();
  }
  super.onDetach();
}