dismiss method
Tears the guide down as a user-driven close — fired when the anchored
screen leaves the tree (the user navigated back or away), mirroring RN's
back_gesture dismissal. Goes through the showcaseview onDismiss →
_finish path so the normal Dismissed analytics fire, unlike the
orchestrator's silent invalidation. anchorLeft is true only from
DigiaAnchor.dispose: on the last step of a multi-step guide it reports
GuideCompleted instead of a step dismissal (A62). Its reason is
DismissReason.screenExit when the host changed screens and
DismissReason.targetLost when the anchor unmounted in place.
reason overrides the terminal reason when the caller knows it (screen
change, live-test supersede, anchorless image failure); otherwise _finish
derives one from the vendor cause or the scrim/close distinction.
No-op when nothing is showing. A guide that was routed but hasn't started
yet (still inside the first step's delayInMs/post-frame wait) settles as
a drop with the real reason instead of a rich dismissal for an unseen guide.
Implementation
void dismiss({bool anchorLeft = false, DismissReason? reason}) {
final resolved = reason ?? (anchorLeft ? _anchorLeftReason() : null);
if (_view.isShowcaseRunning) {
_anchorLeft = anchorLeft;
_pendingDismissReason = resolved;
_view.dismiss();
} else if (_orchestrator.state != null) {
_dismissBeforeShown(reason: resolved);
}
}