waitForAssets method

Future<void> waitForAssets()

Tries to preload all Images (except NetworkImages) in the current widget tree.

Implementation

Future<void> waitForAssets() async {
  if (kIsWeb) {
    return;
  }

  await runAsync(() async {
    var futures = <Future>[];

    for (final image in _listImages()) {
      if (image.provider is! NetworkImage) {
        futures.add(precacheImage(image.provider, image.context));
      }
    }
    await Future.wait(futures);
  });
}