safeByteArray property

Future<Uint8List> get safeByteArray

A future that retrieves the image data as a Uint8List from the appropriate source based on the EditorImageType.

Implementation

Future<Uint8List> get safeByteArray {
  switch (type) {
    case EditorImageType.memory:
      return Future.value(byteArray!);
    case EditorImageType.asset:
      return loadAssetImageAsUint8List(assetPath!);
    case EditorImageType.file:
      return readFileAsUint8List(file!);
    case EditorImageType.network:
      return fetchImageAsUint8List(networkUrl!);
  }
}