load method

Future<Image> load(
  1. String fileName, {
  2. String? key,
  3. String? package,
})

Loads the image at fileName into the cache.

The fileName is the full path of the asset, exactly as declared in the pubspec.yaml, for example assets/images/player.png. When a package is given, the path is resolved relative to that package's assets.

By default the key in the cache is the resolved path, if another key is desired, specify the optional key argument.

Implementation

Future<Image> load(String fileName, {String? key, String? package}) {
  final path = resolvePath(fileName, package);
  return (_assets[key ?? path] ??= _ImageAsset.future(
    _fetchToMemory(path),
  )).retrieveAsync();
}