failedMessageForChannel method

Message? failedMessageForChannel(
  1. ChannelType channelType,
  2. String channelId, {
  3. String? subChannelId,
})

Implementation

Message? failedMessageForChannel(
  ChannelType channelType,
  String channelId, {
  String? subChannelId,
}) {
  Message? latest;
  var latestTime = -1;
  final normalizedSubChannelId = _normalizeSubChannelId(subChannelId);
  for (final message in _failedMessages.values) {
    if (message.channelType != channelType ||
        message.channelId != channelId) {
      continue;
    }
    if (_normalizeSubChannelId(_subChannelIdOf(message)) !=
        normalizedSubChannelId) {
      continue;
    }
    final time = _messageTimeOf(message) ?? -1;
    if (latest == null || time >= latestTime) {
      latest = message;
      latestTime = time;
    }
  }
  return latest;
}