CropRotateEditor.autoSource constructor

CropRotateEditor.autoSource({
  1. Key? key,
  2. required CropRotateEditorInitConfigs initConfigs,
  3. Uint8List? byteArray,
  4. File? file,
  5. String? assetPath,
  6. String? networkUrl,
})

Constructs a CropRotateEditor widget with an image loaded automatically based on the provided source.

Either byteArray, file, networkUrl, or assetPath must be provided.

Implementation

factory CropRotateEditor.autoSource({
  Key? key,
  required CropRotateEditorInitConfigs initConfigs,
  Uint8List? byteArray,
  File? file,
  String? assetPath,
  String? networkUrl,
}) {
  if (byteArray != null) {
    return CropRotateEditor.memory(
      byteArray,
      key: key,
      initConfigs: initConfigs,
    );
  } else if (file != null) {
    return CropRotateEditor.file(
      file,
      key: key,
      initConfigs: initConfigs,
    );
  } else if (networkUrl != null) {
    return CropRotateEditor.network(
      networkUrl,
      key: key,
      initConfigs: initConfigs,
    );
  } else if (assetPath != null) {
    return CropRotateEditor.asset(
      assetPath,
      key: key,
      initConfigs: initConfigs,
    );
  } else {
    throw ArgumentError(
        "Either 'byteArray', 'file', 'networkUrl' or 'assetPath' must be provided.");
  }
}