PaintingEditor.autoSource constructor
PaintingEditor.autoSource({})
Constructs a PaintingEditor
widget with an image loaded automatically based on the provided source.
Either byteArray
, file
, networkUrl
, or assetPath
must be provided.
Implementation
factory PaintingEditor.autoSource({
Key? key,
Uint8List? byteArray,
File? file,
String? assetPath,
String? networkUrl,
required PaintEditorInitConfigs initConfigs,
}) {
if (byteArray != null) {
return PaintingEditor.memory(
byteArray,
key: key,
initConfigs: initConfigs,
);
} else if (file != null) {
return PaintingEditor.file(
file,
key: key,
initConfigs: initConfigs,
);
} else if (networkUrl != null) {
return PaintingEditor.network(
networkUrl,
key: key,
initConfigs: initConfigs,
);
} else if (assetPath != null) {
return PaintingEditor.asset(
assetPath,
key: key,
initConfigs: initConfigs,
);
} else {
throw ArgumentError(
"Either 'byteArray', 'file', 'networkUrl' or 'assetPath' must be provided.");
}
}