CNAlert class
A native iOS/macOS alert dialog.
Alerts give people critical information they need right away. Use alerts sparingly and only for important, actionable information.
Example:
await CNAlert.show(
context: context,
title: 'Delete Photo',
message: 'Are you sure you want to delete this photo? This action cannot be undone.',
actions: [
CNAlertAction(
title: 'Cancel',
style: CNAlertActionStyle.cancel,
),
CNAlertAction(
title: 'Delete',
style: CNAlertActionStyle.destructive,
onPressed: () {
// Perform delete action
},
),
],
);
Constructors
- CNAlert()
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 String title, String? message, required List< CNAlertAction> actions, int? preferredActionIndex}) → Future<int?> - Shows a native alert dialog.
-
showConfirmation(
{required String title, String? message, String confirmTitle = 'Confirm', VoidCallback? onConfirm}) → Future< bool> - Shows a confirmation alert with Cancel and Confirm buttons.
-
showDestructiveConfirmation(
{required String title, String? message, required String destructiveTitle, VoidCallback? onDestroy}) → Future< bool> - Shows a destructive confirmation alert.
-
showInfo(
{required String title, String? message}) → Future< void> - Shows a simple informational alert with an OK button.