As a brief note to self, the Dart/Flutter filter method on a List is actually named where. I’m used to this type of method being named filter in other programming languages, but where is cool, too. Here’s a one-line where example:
final List<File> files = entities.where((e) => (e is File)).toList();
Note: Dart compared to Scala
FWIW, in Scala that code would use a filter method instead of where, and look like something like this:
val files: List<File> = entities.filter(e => e.isFile));
Or more simply, like this:
val files = entities.filter(_.isFile));
But getting back to my point, Dart/List/filter is really Dart/List/where.