whereNotBetween method

List<T> whereNotBetween(
  1. String key,
  2. num start,
  3. num end
)

Filters the collection by determining if a specified item value is outside of a given range

Example:

list.whereNotBetween("key", start, end)

Implementation

List<T> whereNotBetween(String key, num start, num end) {
  if (isEmpty) {
    return <T>[];
  }
  final List<T> result = <T>[];
  for (final T element in this) {
    if (element is Map<T, T> &&
        element.containsKey(key) &&
        element[key] is num) {
      final num value = element[key] as num;
      if (value < start || value > end) {
        result.add(element);
      }
    }
  }

  return result;
}