Skip to content

Commit

Permalink
Removed unnecessary nullable type in maxBy (dart-archive/collection#181)
Browse files Browse the repository at this point in the history
* Removed unnecessary nullable type in maxBy

* Update functions_test.dart
  • Loading branch information
Afsar-Pasha authored Sep 13, 2021
1 parent efb6a82 commit 8764c3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkgs/collection/lib/src/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ S? minBy<S, T>(Iterable<S> values, T Function(S) orderBy,
/// compared using their [Comparable.compareTo].
///
/// Returns `null` if [values] is empty.
S? maxBy<S, T>(Iterable<S> values, T Function(S?) orderBy,
S? maxBy<S, T>(Iterable<S> values, T Function(S) orderBy,
{int? Function(T, T)? compare}) {
compare ??= defaultCompare;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/collection/test/functions_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void main() {
{'foo': 4},
{'foo': 1},
{'foo': 2}
], (map) => map!,
], (map) => map,
compare: (map1, map2) => map1['foo']!.compareTo(map2['foo']!)),
equals({'foo': 5}));
});
Expand Down

0 comments on commit 8764c3f

Please sign in to comment.