parse<E> method

Iterable<E> parse<E>({
  1. E? parser(
    1. Object? raw
    )?,
  2. bool check(
    1. E e
    )?,
})

Implementation

Iterable<E> parse<E>({
  E? Function(Object? raw)? parser,
  bool Function(E e)? check,
}) {
  if (isEmpty) return const [];
  return map((e) {
    final v = parser?.call(e) ?? e;
    if (v is! E) return null;
    if (check != null && !check(v)) return null;
    return v;
  }).whereType<E>();
}