whereNotBetween method
Filters the list to exclude elements where the specified key's value is within the given range.
key is the key to check.
start is the lower bound of the range (exclusive).
end is the upper bound of the range (exclusive).
Example:
final filteredList = list.whereNotBetween("price", 100, 1000);
Implementation
List<T> whereNotBetween(String key, num start, num end) {
if (isEmpty) {
return <T>[];
}
return whereType<Map<String, dynamic>>()
.where((element) =>
element.containsKey(key) &&
element[key] is num &&
((element[key] as num) < start || (element[key] as num) > end))
.map((e) => e as T)
.toList();
}