BaseCNAlert class

@Deprecated - Use BaseAlert instead

BaseCNAlert has been renamed to BaseAlert for consistency. BaseAlert provides the same native iOS UIAlertController rendering via platform channels and Material AlertDialog fallback.

Additionally, the public API now uses BaseAlertAction instead of CNAlertAction.

Migration:

// Old
await BaseCNAlert.show(
  context: context,
  title: 'Delete',
  message: 'Are you sure?',
  actions: [
    CNAlertAction(title: 'Cancel', style: CNAlertActionStyle.cancel),
    CNAlertAction(title: 'Delete', style: CNAlertActionStyle.destructive),
  ],
)

// New
await BaseAlert.show(
  context: context,
  title: 'Delete',
  message: 'Are you sure?',
  actions: [
    BaseAlertAction(title: 'Cancel', style: BaseAlertActionStyle.cancel),
    BaseAlertAction(title: 'Delete', style: BaseAlertActionStyle.destructive),
  ],
)

Rename classes:

  • BaseCNAlert → BaseAlert
  • CNAlertAction → BaseAlertAction
  • CNAlertActionStyle → BaseAlertActionStyle
Annotations
  • @Deprecated('Use BaseAlert with BaseAlertAction instead. BaseCNAlert will be removed in a future version.')

Constructors

BaseCNAlert()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

show({required BuildContext context, required String title, String? message, required List<CNAlertAction> actions, int? preferredActionIndex, BaseParam? cupertino, BaseParam? material}) → Future<int?>
Shows a native alert dialog.
showConfirmation({required BuildContext context, required String title, String? message, String confirmTitle = 'Confirm', VoidCallback? onConfirm}) → Future<bool>
Shows a confirmation alert with Cancel and Confirm buttons.
showDestructiveConfirmation({required BuildContext context, required String title, String? message, String destructiveTitle = 'Delete', VoidCallback? onDestroy}) → Future<bool>
Shows a destructive confirmation alert with Cancel and destructive action.
showInfo({required BuildContext context, required String title, String? message}) → Future<void>
Shows an informational alert with a single OK button.