getCachedContactDetail function

AtContact? getCachedContactDetail(
  1. String? atsign
)

returns atsign's AtContact details from cached list, if present

Implementation

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