find<T extends V> method

T? find<T extends V>(
  1. bool callback(
    1. V element
    )
)

Returns the first element satisfying test, or null if there are none.

Example :

Channel? channel = guild.channels.cache.find((channel) => channel.id == '991686152585232404');
print(channel);

Implementation

T? find<T extends V> (bool Function(V element) callback) {
  final MapEntry<K, V>? result = entries.firstWhereOrNull((item) => callback(item.value));
  return result?.value as T?;
}