findAll<T extends Cacheable> method

  1. @override
List<T>? findAll<T extends Cacheable>({
  1. String? channelKey,
})
override

Implementation

@override
List<T>? findAll<T extends Cacheable>({String? channelKey}) {
  //find channels only support atm
  if (T == OpenChannel || T == GroupChannel) {
    return _cacheMap.values
        .where((e) => e.channel is T)
        .map((e) => e.channel as T)
        .toList();
  } else if (T == ReadStatus && channelKey != null) {
    return _cacheMap[channelKey]?.readStatus.values.toList() as List<T>;
  } else if (T == TypingStatus) {
    return _cacheMap[channelKey]?.typingStatus.values.toList() as List<T>;
  } else if (T == DeliveryStatus) {
    return [_cacheMap[channelKey]?.deliveryStatus] as List<T>;
  }
  return null;
}