FilterEditor.autoSource constructor

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

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

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

Implementation

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