diff options
author | uvok | 2025-07-30 13:18:45 +0200 |
---|---|---|
committer | uvok | 2025-07-30 13:18:45 +0200 |
commit | a5696a551577293f7afd4986119dd2d6636b1fdf (patch) | |
tree | 51504612afe0f09efc04d63d1e0e283d4cc96f4c /lib | |
parent | 4311e39e65de3ed10f145e556085e7fb238e6e60 (diff) |
firstWhereOrNull works on any iterable
Diffstat (limited to 'lib')
-rw-r--r-- | lib/first_where_ext.dart | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/first_where_ext.dart b/lib/first_where_ext.dart index 7e297ff..a633b91 100644 --- a/lib/first_where_ext.dart +++ b/lib/first_where_ext.dart @@ -1,5 +1,6 @@ -extension FirstWhereExt<T> on List<T> { +extension FirstWhereExt<T> on Iterable<T> { /// The first element satisfying [test], or `null` if there are none. + // firstWhereOrElse doesn't want to return null. T? firstWhereOrNull(bool Function(T element) test) { for (final element in this) { if (test(element)) return element; |