Showing
3 changed files
with
17 additions
and
3 deletions
1 | +## [4.0.0-nullsafety.0] | ||
2 | +- Migrate to null-safety | ||
3 | +- Added ScrollMixin to controllers | ||
4 | +- Added loadingMore status to RxStatus | ||
5 | +- Breaking: It is not possible to initialize Rx with null values. | ||
6 | + | ||
1 | ## [3.25.6] | 7 | ## [3.25.6] |
2 | - Added documentation in French (@kamazoun) | 8 | - Added documentation in French (@kamazoun) |
3 | - Fix logs messages (@damphat) | 9 | - Fix logs messages (@damphat) |
1 | -import 'package:collection/collection.dart' show IterableExtension; | ||
2 | - | ||
3 | import '../../../get_core/src/get_main.dart'; | 1 | import '../../../get_core/src/get_main.dart'; |
4 | import '../../get_navigation.dart'; | 2 | import '../../get_navigation.dart'; |
5 | import '../routes/get_route.dart'; | 3 | import '../routes/get_route.dart'; |
@@ -106,3 +104,13 @@ class ParseRouteTree { | @@ -106,3 +104,13 @@ class ParseRouteTree { | ||
106 | return params; | 104 | return params; |
107 | } | 105 | } |
108 | } | 106 | } |
107 | + | ||
108 | +extension FirstWhereExt<T> on List<T> { | ||
109 | + /// The first element satisfying [test], or `null` if there are none. | ||
110 | + T? firstWhereOrNull(bool Function(T element) test) { | ||
111 | + for (var element in this) { | ||
112 | + if (test(element)) return element; | ||
113 | + } | ||
114 | + return null; | ||
115 | + } | ||
116 | +} |
-
Please register or login to post a comment