From a5696a551577293f7afd4986119dd2d6636b1fdf Mon Sep 17 00:00:00 2001 From: uvok Date: Wed, 30 Jul 2025 13:18:45 +0200 Subject: firstWhereOrNull works on any iterable --- lib/first_where_ext.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') 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 on List { +extension FirstWhereExt on Iterable { /// 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; -- cgit v1.2.3