remove function

List remove(
  1. List list,
  2. dynamic predicate
)

Implementation

List remove(List list, dynamic predicate) {
  List removed = [];
  list.removeWhere((element) {
    if (evaluatePredicate(predicate, element)) {
      removed.add(element);
      return true;
    }
    return false;
  });
  return removed;
}