remoteUrls static method

Future<Map<String, String>> remoteUrls(
  1. AssetBundle bundle
)

The slot → URL map bundle carries in remoteManifest, read once per bundle. A missing or unreadable manifest reads as empty and is not remembered, so a live-preview rebuild that adds remote media is seen.

Implementation

static Future<Map<String, String>> remoteUrls(AssetBundle bundle) {
  return _remotes[bundle] ??= () async {
    try {
      final value = jsonDecode(await bundle.loadString(remoteManifest));
      final slots =
          (value as Map<String, dynamic>)['slots'] as Map<String, dynamic>;
      return slots.map((key, value) => MapEntry(key, value as String));
    } catch (_) {
      // Bundled/offline apps need no remote manifest. Do not retain a
      // miss across a live-preview rebuild that introduces remote media.
      _remotes[bundle] = null;
      return <String, String>{};
    }
  }();
}