2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2026-04-03 17:58:21 +00:00
This commit is contained in:
2022-09-18 23:57:56 +03:00
parent 7ed3c5c915
commit 9cb6e3e5b8
3 changed files with 12 additions and 0 deletions

View File

@@ -73,6 +73,12 @@ class AutoList<T, ST> extends IDestructible with IterableMixin<T> {
emitArgs("add", [_state, value]);
}
T? first(bool Function(T element) selector) {
final res = _list.where(selector);
return res.isEmpty ? null : res.first;
}
/// <summary>
/// Add an array of items to the list
/// </summary>

View File

@@ -78,6 +78,11 @@ class KeyList<KT, T> extends IEventHandler with MapMixin<KT, T> {
}
}
T? first(bool Function(T element) selector) {
final res = _map.where(selector);
return res.isEmpty ? null : res.first;
}
_itemDestroyed(T sender) {
removeValue(sender);
}