2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2026-04-03 17:58:21 +00:00

null-safety

This commit is contained in:
2021-07-24 13:12:43 +03:00
parent 6be04c39ed
commit 614c6853e3
48 changed files with 3022 additions and 3320 deletions

View File

@@ -43,9 +43,9 @@ class KeyList<KT, T> extends IEventHandler with MapMixin<KT, T> {
at(int index) => _map.values.elementAt(index);
bool _removableList;
late bool _removableList;
T take(KT key) {
T? take(KT key) {
if (_map.containsKey(key)) {
var v = _map[key];
remove(key);
@@ -89,20 +89,20 @@ class KeyList<KT, T> extends IEventHandler with MapMixin<KT, T> {
clear() {
if (_removableList)
for (var v in _map.values)
(v as IDestructible)?.off("destroy", _itemDestroyed);
(v as IDestructible).off("destroy", _itemDestroyed);
_map.clear();
emitArgs("cleared", [this]);
}
T remove(key) {
T? remove(key) {
if (!_map.containsKey(key)) return null;
var value = _map[key];
if (_removableList)
(value as IDestructible)?.off("destroy", _itemDestroyed);
(value as IDestructible).off("destroy", _itemDestroyed);
_map.remove(key);