This extension filters data by either validating or sanitizing it. This is especially useful when the data source contains unknown (or foreign) data, like user supplied input. For example, this data may come from an HTML form.
Dart filters lists through the
List.retainWhere methods. The
where function takes one argument: a boolean function that is applied to each element of the list. If the function evaluates to
true then the list element is retained; if the function evaluates to
false, the element is removed.
theList.retainWhere(foo) is practically equivalent to setting
theList = theList.where(foo).