getOrCacheAndRegister method

Future<String> getOrCacheAndRegister({
  1. required String cacheKey,
  2. required Future<Uint8List> loader(),
  3. required String targetPath,
})

Simple version without progress tracking

Use this for instant loads (assets, bundled) where progress isn't needed. Delegates to getOrCacheAndRegisterWithProgress and ignores progress events.

Implementation

Future<String> getOrCacheAndRegister({
  required String cacheKey,
  required Future<Uint8List> Function() loader,
  required String targetPath,
}) async {
  // Delegate to progress version, ignore progress events
  await for (final _ in getOrCacheAndRegisterWithProgress(
    cacheKey: cacheKey,
    loader: (_) => loader(), // Ignore progress callback
    targetPath: targetPath,
  )) {
    // Ignore progress updates
  }

  return targetPath;
}