filter method
Returns a list containing only elements matching the given predicate
.
Implementation
KtList<T> filter(bool Function(T) predicate) {
final filtered = filterTo(mutableListOf<T>(), predicate);
// TODO ping dort-lang/sdk team to check type bug
// When in single line: type "DartMutableList<String>' is not a subtype of type 'Null"
return filtered;
}