getCachedContactDetail function

AtContact? getCachedContactDetail(
  1. String? atsign
)

Retrieves the cached contact details for an @sign

Implementation

AtContact? getCachedContactDetail(String? atsign) {
  if (atsign ==
      KeyStreamService().atContactImpl?.atClient?.getCurrentAtSign()) {
    return KeyStreamService().loggedInUserDetails;
  }
  if (KeyStreamService().contactList.isNotEmpty) {
    var index = KeyStreamService()
        .contactList
        .indexWhere((element) => element.atSign == atsign);
    if (index > -1) return KeyStreamService().contactList[index];
  }
  return null;
}