waitForAssets method
Tries to preload all Image
s (except NetworkImage
s) 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);
});
}