getCachedContactDetail function

AtContact? getCachedContactDetail(
  1. String atsign
)

Function to fetch the contact details of an atsign from cached list

Implementation

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