getImageOfAtsignNew method

Future<Uint8List?> getImageOfAtsignNew(
  1. String? atsign
)

Retrieves the image of an atsign from the contact details

Implementation

Future<Uint8List?> getImageOfAtsignNew(String? atsign) async {
  try {
    AtContact contact;
    Uint8List? image;
    contact = await getAtSignDetails(atsign);

    // ignore: unnecessary_null_comparison
    if (contact != null) {
      if (contact.tags != null && contact.tags!['image'] != null) {
        List<int> intList = contact.tags!['image'].cast<int>();
        image = Uint8List.fromList(intList);
      }
    }
    return image;
  } catch (e) {
    return null;
  }
}