update method

  1. @mustCallSuper
Future<void> update(
  1. String identifier, {
  2. bool checkAfterUpdate = true,
})
inherited

Update content from your source

Implementation

@mustCallSuper
Future<void> update(String identifier, {bool checkAfterUpdate = true}) async {
  if (_isUpdating[identifier] == null) {
    _isUpdating[identifier] = contentGetter(identifier);
  }
  var content = await _isUpdating[identifier]!;
  if (content != null) {
    if (_cacheDates.containsKey(identifier)) {
      _cacheDates.remove(identifier);
    }

    _contents[identifier] = content;
    _cacheDates[identifier] = content.cacheTime.millisecondsSinceEpoch;
  }
  if (checkAfterUpdate) {
    await _checkNeedsRemove();
  }
  //ignore: unawaited_futures
  _isUpdating.remove(identifier);
  return;
}