loadBytes method

  1. @override
Future<ByteData> loadBytes(
  1. BuildContext? context
)
override

Loads the SVG bytes, utilizing caching to avoid unnecessary repeated loads.

This method intentionally avoids using await to help tests and reduce unnecessary event loop turns.

Implementation

@override
Future<ByteData> loadBytes(BuildContext? context) {
  return svg.cache.putIfAbsent(cacheKey(context), () => _load(context));
}