-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40a101e
commit 3719c2c
Showing
2 changed files
with
11 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,4 @@ rules: | |
- Wip | ||
type-empty: | ||
- 1 | ||
- never | ||
scope-enum: | ||
- 2 | ||
- always | ||
- - flodash | ||
- enhanced-http | ||
- never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import '../../_utils/_array.dart'; | ||
|
||
@Deprecated("Use inbuilt List.firstWhere() instead") | ||
dynamic find(List list, dynamic iteratee) { | ||
try { | ||
return list.firstWhere((element) => evaluatePredicate(iteratee, element)); | ||
} catch (e) { | ||
return null; | ||
} | ||
/// Iterates over elements of collection, returning the first element predicate returns truthy for. The predicate is invoked with the value of the current item. | ||
/// Arguments | ||
/// - list (List): The collection to inspect. | ||
/// - [iteratee] (dynamic): The iteratee invoked per iteration. | ||
/// | ||
/// Returns | ||
/// (T?): Returns the matched element, else null. | ||
T? find<T>(List<T> list, dynamic iteratee) { | ||
return list.firstWhere((element) => evaluatePredicate(iteratee, element), | ||
orElse: () => null); | ||
} |