close method

void close()

Tear down the dialog. Safe to call multiple times and from any async continuation; later calls are silently ignored.

Pops via the dialog's own BuildContext (captured at build time), using the root navigator so that nested dialogs cannot accidentally route the pop to the wrong target.

Implementation

void close() {
  if (_closed) return;
  _closed = true;
  final dialogContext = _dialogContext;
  if (dialogContext != null && dialogContext.mounted) {
    Navigator.of(dialogContext, rootNavigator: true).pop();
  }
}