load method

Future load(
  1. dynamic image
)

Implementation

Future load(dynamic image) async {
  loader = Completer<bool>();

  if (image is ImageItem) {
    bytes = image.bytes;

    height = image.height;
    width = image.width;

    return loader.complete(true);
  } else if (image is Uint8List) {
    bytes = image;
    var decodedImage = await decodeImageFromList(bytes);

    height = decodedImage.height;
    width = decodedImage.width;

    return loader.complete(true);
  } else if (image is XFile) {
    bytes = await image.readAsBytes();
    var decodedImage = await decodeImageFromList(bytes);

    height = decodedImage.height;
    width = decodedImage.width;

    return loader.complete(true);
  } else {
    return loader.complete(false);
  }
}