whereNotOnly method

List<T> whereNotOnly(
  1. List<String> keys
)

Removes elements from the list which is given

Example:

list.whereNotOnly([key1, key2])

Implementation

List<T> whereNotOnly(List<String> keys) {
  if (isEmpty) {
    return <T>[];
  }
  final List<T> result = <T>[];

  for (final T element in this) {
    if (element is Map<String, T>) {
      for (final String key in keys) {
        if (element.containsKey(key)) {
          element.remove(key);
        }
      }
      if (element.isNotEmpty) {
        result.add(element);
      }
    }
  }

  return this;
}