shouldRemoveImageCallback property

ImageEmbedBuilderWillRemoveCallback? shouldRemoveImageCallback
final

shouldRemoveImageCallback is a callback function that is invoked when the user attempts to remove an image from the editor. It allows you to control whether the image should be removed based on your custom logic.

Example of shouldRemoveImageCallback customization:

shouldRemoveImageFromEditor: (imageFile) async {
  // Show a confirmation dialog before removing the image
  final isShouldRemove = await showYesCancelDialog(
    context: context,
    options: const YesOrCancelDialogOptions(
      title: 'Deleting an image',
      message: 'Are you sure you want' ' to delete this
     image from the editor?',
    ),
  );

  // Return `true` to allow image removal if the user confirms, otherwise
 `false`
  return isShouldRemove;
}

Implementation

final ImageEmbedBuilderWillRemoveCallback? shouldRemoveImageCallback;