ProImageEditor.file constructor

ProImageEditor.file(
  1. File file, {
  2. Key? key,
  3. ProImageEditorConfigs configs = const ProImageEditorConfigs(),
  4. required ProImageEditorCallbacks callbacks,
})

This constructor creates a ProImageEditor widget configured to edit an image loaded from the specified file.

The file parameter should point to the image file.

The key parameter is an optional parameter used to provide a Key to the widget for identification and state preservation.

The configs parameter specifies the configuration options for the image editor. It defaults to an empty instance of ProImageEditorConfigs.

The callbacks parameter is required and specifies the callbacks to handle events and interactions within the image editor.

Example usage:

ProImageEditor.ProImageEditor.file(
  File(pathToMyFile),
  configs: ProImageEditorConfigs(),
  callbacks: ProImageEditorCallbacks(
     onImageEditingComplete: (Uint8List bytes) async {
       /*
         `Your code to handle the edited image. Upload it to your server as an example.

          You can choose to use await, so that the load dialog remains visible until your code is ready,
          or no async, so that the load dialog closes immediately.
       */
       Navigator.pop(context);
     },
  ),
)

Implementation

factory ProImageEditor.file(
  File file, {
  Key? key,
  ProImageEditorConfigs configs = const ProImageEditorConfigs(),
  required ProImageEditorCallbacks callbacks,
}) {
  return ProImageEditor._(
    key: key,
    file: file,
    configs: configs,
    callbacks: callbacks,
  );
}