updateElementwithKey method Null safety

Future<void> updateElementwithKey(
  1. String key,
  2. String value
)

Update Element in the Flutter Storage and in the private Variablelist _items

Implementation

Future<void> updateElementwithKey(String key, String value) async {
  for (var i = 0; i < _items.length; i++) {
    if (_items[i].key == key) {
      var newitem = _SecItem(key, value);
      _items[i] = _SecItem(key, value);
      await writeToSecureStorage(newitem);
      return;
    }
  }
}