getImageBytes method

Future<Uint8List> getImageBytes()

Implementation

Future<Uint8List> getImageBytes() async {
  if(b64Json != null) {
    return base64Decode(b64Json!);
  }
  else if (url != null) {
    var response = await http.get(Uri.parse(url!));
    if(response.statusCode == 200) {
      return response.bodyBytes;
    }
  }
  throw UnsupportedError("Failed to load image bytes.");
}