getImage method

Future<Uint8List> getImage(
  1. String savedKey
)

Implementation

Future<Uint8List> getImage(String savedKey) async {
  if (savedKey.startsWith('AtKey{')) {
    // removing 'AtKey{' and ending '}'
    savedKey = savedKey.substring(6, savedKey.length - 1);

    var key = constructKey(savedKey);
    var keyValue = await atClientManager.atClient.get(key).catchError((e) {
      return AtValue();
    });
    // ignore: unnecessary_null_comparison
    if (keyValue != null && keyValue.value != null) {
      return keyValue.value;
    } else {
      // return empty list
      return Uint8List(0);
    }
  } else {
    return Uint8List(0);
  }
}