update static method

Future<void> update(
  1. String key, {
  2. UStorageBucket bucket = UStorageBucket.support,
  3. Duration? expireIn,
  4. String? mimeType,
  5. Map<String, String>? tags,
})

Updates expiry, MIME type or tags without rewriting the data.

Implementation

static Future<void> update(String key, {UStorageBucket bucket = UStorageBucket.support, Duration? expireIn, String? mimeType, Map<String, String>? tags}) async {
  await _ensure();
  final UStorageEntry? entry = _live(key, bucket);
  if (entry == null) return;
  if (expireIn != null) entry.expires = DateTime.now().add(expireIn);
  if (mimeType != null) entry.mimeType = mimeType;
  if (tags != null) entry.tags = tags;
  _scheduleSave(_index(bucket));
}