prefetch method

void prefetch(
  1. String bundleUrl
)

Implementation

void prefetch(String bundleUrl) {
  final key = skinKeyFromUrl(bundleUrl);
  if (key == null) {
    _log.w('Skin prefetch skipped, unusable bundleUrl');
    return;
  }
  final gen = _generation;
  _active++;
  final next = _queue.then((_) {
    if (gen != _generation) return null;
    return _downloadOnce(bundleUrl, key);
  });
  _queue = next.then((_) {}, onError: (_) {
    _log.w('Skin prefetch dropped, will retry at the next trigger');
  }).whenComplete(() {
    if (gen == _generation) _active--;
  });
}