feat: Remove list helpers
Use the collection package instead.
This commit is contained in:
parent
2a469e10e8
commit
7e55015948
@ -1,16 +0,0 @@
|
||||
/// A wrapper around List<T>.firstWhere that does not throw but instead just
|
||||
/// returns true if [test] returns true for an element or false if [test] never
|
||||
/// returned true.
|
||||
bool listContains<T>(List<T> list, bool Function(T element) test) {
|
||||
return firstWhereOrNull<T>(list, test) != null;
|
||||
}
|
||||
|
||||
/// A wrapper around [List<T>.firstWhere] that does not throw but instead just
|
||||
/// return null if [test] never returned true
|
||||
T? firstWhereOrNull<T>(List<T> list, bool Function(T element) test) {
|
||||
try {
|
||||
return list.firstWhere(test);
|
||||
} catch(e) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
library moxlib;
|
||||
|
||||
export 'awaitabledatasender.dart';
|
||||
export 'lists.dart';
|
||||
export 'math.dart';
|
||||
|
Loading…
Reference in New Issue
Block a user