activeModalId property

String? get activeModalId

Returns the unique ID of the currently active modal

Returns null if no modal is active. This is useful for programmatic tracking and conditional logic.

Example:

if (Modal.activeModalId == 'myDialog') {
  // Handle specific modal
}

Implementation

static String? get activeModalId => _activeModalController.state?.uniqueId;