partition function

List partition(
  1. dynamic list,
  2. dynamic iteratee
)

Implementation

List partition(dynamic list, dynamic iteratee) {
  if (list is String) list = list.split('');
  return reduce(list, (List<List<dynamic>> result, dynamic value, int index) {
    if (evaluatePredicateKey(iteratee, value)) {
      result[0].add(value);
    } else {
      result[1].add(value);
    }
    return result;
  }, [[], []]);
}