preResolveSnapshots method

  1. @override
Future<void> preResolveSnapshots(
  1. Iterable<SnapshotSource> sources,
  2. SnapshotService service
)
override

Rasterizes every snapshot in sources through service and decodes each raster to a ui.Image cached by content hash, so decodedSnapshotFor can answer synchronously during the frame loop.

Runs in the pre-resolve pass before the frame loop and is idempotent: a source already resolved is skipped (its cache entry is reused). Throws a FluvieRenderException when a raster cannot be decoded, and surfaces the service's FluvieSnapshotUnavailableError when the backend is missing.

Implementation

@override
Future<void> preResolveSnapshots(
  Iterable<SnapshotSource> sources,
  SnapshotService service,
) async {
  if (sources.isNotEmpty) {
    throw FluvieRenderException(
      'NoMediaResolver cannot resolve snapshots (got ${sources.length} '
      'source(s), first: "${sources.first}"). Wire a MediaRepository through '
      'mediaResolverProvider to render Mermaid/WebView/Html, or keep this '
      'resolver for snapshot-less compositions.',
    );
  }
}