showConfirmDialog static method

Future<bool?> showConfirmDialog({
  1. String? title,
  2. String? message,
  3. String positiveButtonText = defaultPositiveButtonText,
  4. String negativeButtonText = defaultNegativeButtonText,
  5. bool destructive = false,
})

Shows an alert dialog asking the user for a confirmation

This alert contains an optional title, message. positiveButtonText and negativeButtonText will be shown on the corresponding buttons. When the user clicks on positiveButtonText this will return true. When the user clicks on negativeButtonText this will return false. destructive can be set to true to show the user this is a destructive operation (only on iOS).

Implementation

static Future<bool?> showConfirmDialog({
  String? title,
  String? message,
  String positiveButtonText = defaultPositiveButtonText,
  String negativeButtonText = defaultNegativeButtonText,
  bool destructive = false,
}) async {
  return await _channel.invokeMethod(
    'dialog.confirm',
    {
      "title": title,
      "message": message,
      "positiveButtonText": positiveButtonText,
      "negativeButtonText": negativeButtonText,
      "destructive": destructive,
    },
  );
}