fluvie library
Write a video like a Flutter screen: widgets in, a real video file out.
Import this single barrel and nothing else:
import 'package:fluvie/fluvie.dart';
The public surface grows phase by phase and is always re-exported from
here; src/ stays private.
Classes
- AbsoluteTrigger
- The Trigger.at variant: an absolute time within the enclosing scene.
- Adaptive
- One definition, many aspect ratios: picks the branch matching the active Aspect and builds it.
- AfterTrigger
- The Trigger.after variant: when anchor's timeline ends.
- Anchor
- A typed handle that names an element's timeline so triggers can reference it — no strings, so autocomplete, rename-refactor, and "find usages" work.
- AnchorTable
- Mints one canonical Anchor per string id for a single spec document.
- Angle
- A rotation expressed in whichever unit reads best at the call site.
- Animation
-
The one unit of motion: everything visual — transforms, opacity, color,
and pixel post-effects — is an Animation in the same
.animate([...])list. - AnimationEffect
-
The contract every visual animation reduces to: a pure function of
progressapplied to a child widget. - AnimationSpec
-
The data form of one
.animate([...])entry: either a named preset plus its arguments, or a rawfrom/to/fromTokeyframe animation, in both cases carrying the common timing tail (duration,ease,spring,delay,at,stagger,repeat,label). - Arrow
- An annotation arrow pointing at a target: a stroked shaft with a filled triangular head.
- AspectScope
-
Carries the active Aspect down to
Adaptiveand any element that branches on AspectScope.of — the multi-aspect counterpart to the render-mode and noise scopes. - AssetSource
- A MediaSource backed by a bundled asset key.
- Audio
-
One audio track on a
VideoorScene: background music or a one-shot sound effect. - AutoTrigger
- The Trigger.auto variant: the element's own window edge.
- Background
- A full-canvas backdrop — one widget, seven looks.
- BackgroundSpec
-
The data form of a Background: a
kindplus that variant's properties. - Bars
- A spectrum-bar visualizer driven by a precomputed audio band table — an intrinsic, frame-driven element.
- BeatDetectionService
-
Detects the beats of one audio track and emits them as a
BeatGridin absolute video-frame space. - BeatTrigger
- The Trigger.beat variant: fire on the audio track's beat grid.
- Box
- A solid block, bar, or divider — animatable like anything else:
- Callout
- A label that points at a target with an arrow, annotating a child.
- Camera
- A scene-wide camera move: a Transform.scale driven by the scene clock, applied outside every element transform but inside the compositor's blend.
- CaptionCue
-
One parsed caption block: the text shown over its
[start, end]window, with optional word-level timing for karaoke and word-pop. - CaptionCueWord
- One word inside a CaptionCue with its own start time — the unit karaoke highlights and word-pop staggers.
- CaptionPosition
- Where a caption sits on the canvas: an alignment plus a safeArea inset in logical pixels.
- Captions
- A first-class caption track: imported from SRT/VTT or built inline, styled and safe-area positioned.
- CaptionStyle
- How a caption track is drawn: the textStyle of the words, the background behind them, the highlight color of the active word, and the wordPop / karaoke behavior flags the caption layer reads.
- CaptionTheme
-
The caption design tokens: the defaultStyle the caption layer falls back
to when a
Captionstrack declares nostyle:. - CaptionWord
- One word of an inline caption track: the text and when it appears.
- CaptureSink
- A growable byte sink the capture loop appends raw frame bytes to.
- Chart
- The chart family — an intrinsic, frame-driven element whose reveal is built into its own constructor.
- ChartAreaFactory
-
The callable behind
Chart.area: invoke it for a single series, or call series for several stacked fills. - ChartLineFactory
-
The callable behind
Chart.line: invoke it for a single series, or call series for several colored polylines. - ChartPalette
- An ordered list of series colors a chart cycles through.
- ChartPoint
-
One
(x, y)sample in a chart series, with an optional label (decision D4). - ChartScatterFactory
-
The callable behind
Chart.scatter: invoke it with explicitpointsor a category → valuedatamap, or call series for a colored point series. - ChartSeries
- One named, optionally colored series of chart data.
- Clip
-
An embedded video — Fluvie's own widget under Flutter's familiar
Clipname (the barrel hides Flutter's). - ClipAudio
-
The audio policy a
Clipcarries — a data-only value type. - Code
- Renders syntax-highlighted source as a frame-driven element — an intrinsic widget whose constructor takes content behaviour only.
- CodeReveal
-
How a
Codeelement reveals its source over its window: all at once, glyph by glyph, or whole line by whole line. - CodeTheme
-
The colors a
Code(andTerminal) element paints with. - Connector
- A line linking two explicit points — the explicit-position form; anchor-geometry resolution is not yet supported.
- Counter
-
Counts a number from from to to across its window — an intrinsic,
frame-driven element formatted by an
intlNumberFormat. - Defaults
- Inheritable animation defaults: set once, overridable locally.
- DeviceFrame
- Wraps any child in pure presentational device chrome: a phone bezel, a browser window with an address bar, or a tablet bezel.
- DisposableResolver
- A media resolver that holds disposable native resources (decoded images) and can release them eagerly instead of waiting for garbage collection.
- EachStagger
- The Stagger.each variant: a fixed gap between consecutive children.
- Ease
- Curated, plainly-named easing curves for duration-timed animations.
- ElementSpec
-
The data form of one scene child: a
type, its contentprops, an optionalanchorid, and theanimatelist applied through.animate(...). - EvenlyStagger
- The Stagger.evenly variant: children share one fixed span.
- Export
- What the render should produce: an MP4, a GIF, an image sequence, or an alpha-capable overlay.
- FadeBox
- The render-safe fade primitive: one named place where every Fluvie fade becomes pixels.
- FileRenderSandbox
- A file-backed RenderSandbox under a real directory.
- FileSource
- A MediaSource backed by a file on disk.
- FluvieSpecWarning
- A non-fatal spec diagnostic: a property Fluvie does not recognize and would silently ignore while rendering.
- FluvieTheme
- Centralizes a subtree's brand palette, type scale, and motion defaults.
- FluvieTokens
-
The design tokens elements read for color, type, and motion: the value a
FluvieThememounts andcontext.fluvieresolves. - FluvieTokensScope
-
Carries FluvieTokens down the tree so charts and captions can read
theme colors via
context.fluvie. - Frame
-
An optional decorative wrapper around visual content — the replacement for
the old
PhotoCard/PolaroidFramewidgets. - FrameBuilder
- The escape hatch: when no preset fits, drop to a builder with the resolved frame, progress, fps, scope, seeded noise, and analysed audio and paint anything.
- FrameCache
- Persists captured frames on disk so an unchanged render replays from cache instead of re-capturing.
- FrameCacheStore
-
Adapts a disk FrameCache to the
dart:io-freeFrameStorethe capture loop reads, computing each key from the render digest and frame index. - FrameCaptureService
- Captures the pixels of one already-pumped frame as a RawFrame.
- FrameContext
-
The resolved render state a
FrameBuilderpaints from: the current frame, its progress across the element window, the fps and scope, the seeded noise source, and the analysed audio bands. - FrameExtractionService
- Extracts one decoded frame of a video source as a RawFrame.
- FrameProvider
-
Carries the current frame index down the tree — the runtime counterpart to
the timing layer's
TimeScopeProvider. - FrameTime
- A Time expressed as an exact number of frames, independent of fps.
- FrequencyAnalyzer
-
Analyses one audio track into a per-frame
BandTabledriving spectrum-reactive animations. - Html
- Inline HTML laid out and captured deterministically to a raster — the markup becomes a still image rasterized once before the frame loop at a fixed viewport, never a live web view captured mid-frame (the pre-rasterize rule).
- Image
-
A still image — Fluvie's own widget under Flutter's familiar
Imagename (the barrel hides Flutter's). - InspectorModel
- The whole resolved schedule as a plain, immutable value an inspector UI can bind to: the fps and totalFrames of the render, every animation as an InspectorMotion, every named anchor as a TimelineAnchor, and the timing warnings the resolver collected.
- InspectorMotion
- One resolved animation as the inspector shows it: who animates (ownerId), what it is called (label), when it plays (phase), the absolute frame span it occupies, and the jumpFrame the preview seeks to when the row is tapped.
- Keyframe
- A snapshot of animatable property values — the primitive every animation preset is built on.
- LabelRef
-
A reference to a
Timelinelabel, plus a signed offset applied to the label's recorded playhead position. - LowerThird
- A lower-third name/title bar that slides in from the edge — the broadcast caption over a clip.
- Markdown
- Renders Markdown as a frame-driven element — an intrinsic widget whose constructor takes content behaviour only.
- MarkdownStyle
-
The text styles a
Markdownelement renders its AST with. - MediaResolver
- Pre-resolves every media source before the frame loop and serves the resolved bytes (and decoded images) synchronously during it.
- MediaSource
- One declared piece of media, identified before it is resolved.
- MemoryRenderSandbox
- An in-memory RenderSandbox: every file lives in a map of bytes.
- MemorySource
- A MediaSource backed by verbatim in-memory bytes.
- Mermaid
- A Mermaid diagram rendered deterministically to a raster — the diagram source becomes a still image computed once before the frame loop, never a live view captured mid-frame (the pre-rasterize rule).
- MermaidReveal
-
How a
Mermaiddiagram reveals itself over its window: all at once, by fading its nodes in, or by drawing its edges in. - MermaidTheme
-
The theme a
Mermaiddiagram is rendered with. - MsTime
- A Time expressed as wall-clock milliseconds.
- NetworkAllowlist
- The network safety gate consulted before any media fetch.
- NetworkSource
- A MediaSource backed by a remote URL.
- NoiseSource
-
The seeded randomness source every deterministic effect reads from:
a pure function of its input, never a clock or an unseeded
Random. Identical input always yields the identical scalar, on every machine and every pump, which is what makes grain, glitch, particles, and seededfloatreproducible. - NoMediaResolver
- The media-less MediaResolver: valid only for compositions that declare no media at all.
- NumberFormat
- Provides the ability to format a number in a locale-specific way.
- OriginStagger
- The Stagger.from variant: the wave starts at a StaggerOrigin.
- Palette
-
The brand color palette of a
FluvieTheme: the bg backdrop, the accent brand color, the onBg foreground that reads on bg, and the optional surface / onSurface pair for raised panels. - Particles
-
The declarative spec behind
Animation.particles: pure data describing a field of particles, never the particles themselves. - PixelAnimationEffect
- Marker interface classifying an AnimationEffect as a pixel post-effect.
- PreviousTrigger
- The Trigger.previous variant: chain after the previous animation on the same element.
- RawFrame
- One captured frame: raw RGBA8888 pixels plus the metadata the encoder needs to place them in the stream.
- RelativeTime
- A Time expressed as a fraction of the enclosing window.
- RenderConfig
- Everything one render needs to know: output size, frame rate, the frame window to capture, encode quality, and whether the frame cache may serve repeated frames.
- RenderController
- Drives the frame index during capture and scrubbing — the only clock.
- RenderControllerScope
- Binds a RenderController to the tree by republishing its frame as a FrameProvider.
- RenderManifest
-
The capture sandbox's completion signal and encode plan, written last
(after the frames file is complete) as
manifest.json. - RenderModeContext
- Tells the subtree whether it is being captured or previewed.
- RenderProgress
- A progress update from a render: the current phase, optional frame counts while capturing, and the compositionKey so concurrent renders stay distinguishable in logs.
- RenderSandbox
- Storage for one render: the frames file, the manifest, materialized encoder inputs, and the encoded output.
- RenderService
- Drives the deterministic capture pipeline: pre-resolve media, loop the frames (cache → pump → capture → append), then write the manifest last as the completion signal.
- RepaintBoundaryCaptureService
-
The real FrameCaptureService: rasterizes the RepaintBoundary under the
given key via
toImage(pixelRatio: 1.0)and reads back raw RGBA bytes. - Repeat
- How an animation loops inside its resolved span.
- ResolvedAudioMix
- A whole render's audio resolved to encoder-neutral tracks plus a final masterVolume, ready for a non-FFmpeg encoder to mix.
- ResolvedAudioTrack
- One audio track resolved to encoder-neutral numbers: the source to play plus the timing and gain an encoder needs, with no FFmpeg in sight.
- ResolvedTimeline
- The deterministic schedule of a whole composition: every animation as a TimelineRow with absolute frames, plus any out-of-bounds warnings.
- Scene
- A time-bounded section of a video — the single source of truth for everything inside it.
- SceneEndTrigger
- The Trigger.sceneEnd variant: the enclosing scene's last frame.
- SceneScope
-
Mounts a scene's
TimeScopeProviderinside the enclosing VideoScope. - SceneSpec
-
The data form of a Scene: its
duration, optionalbackground, thechildren, optionalenter/exittransitions, and optionalmotionDefaults. - SceneStartTrigger
- The Trigger.sceneStart variant: the enclosing scene's first frame.
- SecondTime
- A Time expressed as wall-clock seconds.
- Shape
- A stroked annotation primitive — a line, rectangle, circle, or path — drawn over a chart, screenshot, or any frame.
- A shared-element ("hero") slot: the same child in two adjacent scenes, tied together by one anchor, morphs across the transition between them.
- Snapshot
- Rasterizes an arbitrary Flutter subtree once before the frame loop and paints the cached still every frame.
- SnapshotService
-
Rasterizes a
SnapshotRequestto a decoded-readySnapshotRaster— the one boundary every snapshot-backed widget rides. - SnapshotViewport
-
The fixed pixel box a
WebView/Htmlsnapshot is laid out and captured in. - Spotlight
- Dims everything but a lit region, focusing attention on it.
- Spring
- Physics-driven timing: a damped spring that derives its own duration.
- Stagger
- How one animation distributes start offsets across a multi-child target.
- StatHighlight
- A built-in stat card: a Counter headline counting up to a value, with its label beneath.
- StatHighlightProps
- The props of a StatHighlight: the value the headline counts to, its label, and the brand accent / background colors.
- Terminal
- Renders a terminal session as a frame-driven element — an intrinsic widget whose constructor takes content behaviour only.
- TerminalChrome
-
The optional window chrome painted above a
Terminal: a title bar with the three macOS traffic-light dots. - TerminalLine
-
One line in a
Terminalelement: either a typed command or a block of streamed output. - Time
- The single currency for every duration, delay, offset, and trim.
- Timeline
-
An opt-in, GSAP-style timeline that places animations on one shared clock —
the real implementation of the TimelineSchedule contract
Scene.sequenceconsumes. - TimelineAnchor
- One resolved anchor in the timeline: an Anchor's diagnostic name and the absolute video frame its element's timeline starts on.
- TimelinePlacement
-
One resolved step in a
Timeline's placement plan: the animation to play on target, starting at the absolute start. - TimelineProbe
-
The embedder-owned timeline egress: a listenable cell the enclosing
Videopushes its ResolvedTimeline into after every resolution. - TimelineProbeScope
-
Mounts a TimelineProbe above a
Videoso the video can push its resolved timeline up to the embedder. - TimelineRow
- One resolved animation in the timeline: who animates, what the animation is called, when it plays, and the absolute frame span it occupies.
- TimelineSchedule
-
What
Scene.sequenceneeds from a beat-by-beat schedule: a total duration the scene can adopt as its own. - TimeRange
- A window in time: a start and an end, each a symbolic Time.
- TimeScope
- The resolution context a Time resolves against.
- Timing
- How an animation progresses through time.
- TitleCard
- A centered title (and optional subtitle) that reveals over its window — the chapter card between scenes.
- TitleIntro
- A built-in intro card: a centered title that pops in, with an optional subtitle that slides in after it.
- TitleIntroProps
- The props of a TitleIntro: a title, an optional subtitle, and the brand accent / background colors.
- Transition
- How two adjacent scenes blend at their boundary.
- Trigger
- Answers "relative to what does this animation start?"
- Tween
- Fixed-duration timing: progress follows ease over duration.
- TypeScale
-
The type scale of a
FluvieTheme: five text roles — display, title, headline, body, and caption — derived from a single base size by a geometric ratio. - Typewriter
- Reveals text one glyph at a time, driven entirely by the frame — an intrinsic element whose content behaviour is the only thing its constructor controls.
- Video
- The root of a composition: scenes in, one video out.
- VideoProbeResult
- The probed facts of one video stream.
- VideoProbeService
- Reads the stream facts of an encoded video file (codec, size, frame count, duration) — what the determinism tests assert against.
- VideoScope
-
Mounts the root
TimeScopeData: frame0, the video's fps, and its resolved duration. - VideoSize
- A video canvas size in pixels, with presets for the common aspect ratios.
- VideoSpec
- The root data form of a video: the serializable document an LLM emits and Fluvie deserializes into a real Video to render deterministically.
- VideoState
-
Video's internal lifecycle surface — public only so tests can reach it viatester.state<VideoState>(...); everything on it is implementation. -
VideoTemplate<
P> -
A parameterized, data-driven video definition: one build that turns a
Propsvalue of typePinto a Video. - WasmRuntime
- A loaded ffmpeg.wasm instance with its in-memory virtual file system.
- WebClipDecoder
-
Decodes a video clip in the browser from its bytes — the WebCodecs seam the
web
MediaResolverprobes and extracts clip frames through. - WebView
- A live web page captured deterministically to a raster — the page at a URL becomes a still image rasterized once before the frame loop at a fixed viewport, never a live web view captured mid-frame (the pre-rasterize rule).
- WhenStartsTrigger
- The Trigger.whenStarts variant: when anchor's timeline starts.
Enums
- AnimationPhase
- When an animation plays within its element's window.
- Aspect
- The aspect-ratio family a video is rendered for.
- AudioBand
- A frequency band of an analysed audio track, driving spectrum-reactive animations.
- Edge
- A side of an element or frame, used by slide-style animations to say where motion comes from or goes to.
- EffectKind
-
The two pipeline classes of the unified
Animationlist: transforms wrap the widget first; pixel effects post-process the result. - ExportMode
- The four Export variants the render pipeline dispatches on. Stable, public discriminator: the names are the public surface the renderer and the inspector branch on.
- ImageFormat
-
The still-image format of an
Export.imageSequence. - ParticleKind
- The family of particle motion a Particles spec describes.
- Quality
- The visual quality of an encoded export, from smallest file to near-lossless.
- RenderMode
- How the widget tree is being driven right now: a live preview or a deterministic frame capture.
- RenderPhase
- The stage a render is in: capturing frames, encoding them, or finished.
- StaggerOrigin
- Where a stagger wave starts among a target's children.
- TransitionKind
- Which scene-to-scene blend a Transition performs.
- WipeShape
- The reveal geometry of a mask-wipe animation.
Extensions
- Animate on Widget
- The one mechanism for motion: works on any widget, Fluvie's or Flutter's.
- FluvieContext on BuildContext
-
The
context.fluvieaccessor: the design tokens elements read for color, type, and motion. - LabelExtension on String
- Call-site sugar for building a LabelRef from a label name.
- TimeNum on num
- Numeric sugar for building Time values:
- TimeRangeX on Time
- Fluent TimeRange construction from a start Time.
Constants
-
knownAnimationPresets
→ const Set<
String> - The preset names the spec can build, mapped to nothing — a set kept as a map key list so an unknown preset fails at parse time.
-
knownBackgroundKinds
→ const Set<
String> - The background variants the spec can build.
-
knownBackgroundProps
→ const Map<
String, Set< String> > -
The properties each background variant reads, beyond the
kindkey. The single source of truth shared by the parser's unknown-property check andvideoSpecSchema; it must stay in step with whatbuildBackgroundreads. -
knownElementProps
→ const Map<
String, Set< String> > -
The content properties each element type reads, beyond the reserved keys
(
type,anchor,animate). This is the single source of truth shared by the parser's unknown-property check andvideoSpecSchema; it must stay in step with whatbuildElementactually reads inelement_builder.dart. -
knownElementTypes
→ const Set<
String> - The element types the spec can build.
Properties
-
assetBundleProvider
→ Provider<
AssetBundle> -
The asset bundle media assets are read from; defaults to
rootBundleand is overridable with a fake bundle in tests.final -
frameCacheProvider
→ Provider<
FrameCache> -
The frame cache used by the render pipeline; defaults to the shared
fluvie_frame_cachedirectory under the system temp directory and is overridable (for example with a per-test root).final -
frameCaptureServiceProvider
→ Provider<
FrameCaptureService> -
The capture service used by the render pipeline; defaults to
RepaintBoundaryCaptureService and is overridable in tests.
final
-
frameExtractionServiceProvider
→ Provider<
FrameExtractionService> -
The frame extractor used by the clip render path; defaults to
FfmpegFrameExtractionServiceoverprocessRunnerProviderand is overridable with a fake in tests.final -
mediaBytesLoaderProvider
→ Provider<
MediaBytesLoader> -
The per-kind byte source the media resolver resolves over; web-safe (the
file://branch is behind a platform seam), so both platform resolvers build over it.final -
mediaResolverProvider
→ Provider<
MediaResolver> -
The media resolver used by the native render pipeline: a real
MediaRepositoryover the injected loader plus the clip probe/extraction services, streaming clip frames through an on-diskFileClipFrameStoreso a full-resolution or long clip never has to hold every decoded frame in memory. Overridable with a fake in tests;NoMediaResolverstays exported as the deliberate media-less choice.final -
networkAllowlistProvider
→ Provider<
NetworkAllowlist> -
The network safety gate consulted before any media fetch; defaults to a
host-open, https-only allowlist and is overridable to a strict set.
final
-
videoProbeServiceProvider
→ Provider<
VideoProbeService> -
The video probe used by determinism checks and tooling; defaults to
FfprobeVideoProbeServiceoverprocessRunnerProviderand is overridable in tests.final -
videoSpecSchema
→ Map<
String, Object?> -
A JSON Schema (draft-07) describing the
VideoSpecdocument.final
Functions
-
assertNoUnknownSpecProps(
Map< String, Object?> json) → void -
Throws a FluvieSpecError enumerating every unknown property in
json, or returns normally when there are none. -
buildVideo(
VideoSpec spec) → Video -
Builds a real Video from
spec— a free-function alias for VideoSpec.build that reads naturally at call sites. -
collectMediaSources(
List< Scene> scenes) → Set<MediaSource> -
Gathers every declared MediaSource from
scenesbefore the frame loop — a pure structural walk over the constructor data, with no mounting and no async. -
collectSnapshots(
List< Scene> scenes) → List<Snapshot> -
Gathers every Snapshot widget from
scenesin deterministic build order — the in-process subtree-capture sibling of collectSnapshotSources, walking the same tree with no mounting and no async. -
collectSnapshotSources(
List< Scene> scenes) → Set<SnapshotSource> -
Gathers every declared
SnapshotSourcefromscenesbefore the frame loop — the snapshot sibling of collectMediaSources, walking the same tree with no mounting and no async. -
createWasmRuntime(
) → WasmRuntime - VM stub: there is no ffmpeg.wasm outside the browser.
-
debugTimeline(
ResolvedTimeline timeline) → String -
Renders
timelineas a fixed-width text table — the dump behind timing assertions and the inspector: -
effectKindOf(
AnimationEffect effect) → EffectKind -
Classifies
effectfor pipeline ordering: pixel iff it implements PixelAnimationEffect, transform otherwise. -
frameCountFor(
Duration duration, int fps) → int -
The number of frames a render of
durationatfpsproduces (at least one). -
render(
{required Widget composition, required Aspect aspect, required int frameCount, required Directory outDir, required RenderService service, required ShellMount pumpWidget, required ShellFramePump pumpFrame, int longEdge = 1920, int fps = 30, String compositionKey = 'render', bool cacheEnabled = false, AudioMixStager? stageAudio, Iterable< AudioSource> ? audioSources, MediaResolver? resolver}) → Future<RenderAspectResult> -
Renders
compositionfor a singleaspect— the canonical multi-aspect entry. -
renderTemplate<
P> (VideoTemplate< P> template, {required P props, required int frameCount, required Directory outDir, required RenderService service, required ShellMount pumpWidget, required ShellFramePump pumpFrame, Aspect aspect = Aspect.reels, int longEdge = 1920, int fps = 30, String compositionKey = 'template', bool cacheEnabled = false}) → Future<RenderAspectResult> -
Renders a parameterized VideoTemplate for one
Propsvalue — the data-driven-batch entry. -
renderToSandbox(
{required Widget composition, required Aspect aspect, required int frameCount, required RenderSandbox sandbox, required FrameCaptureService capture, required SandboxMount pumpWidget, required SandboxFramePump pumpFrame, int longEdge = 1920, int fps = 30, String compositionKey = 'render', Export? export, int? posterFrame, ProgressCallback? onProgress, VideoEncoderService encoder = const VideoEncoderService(), List< ResolvedAudioTrack> audioTracks = const [], AudioByteLoader? loadAudioBytes, double audioMasterVolume = 1, MediaResolver? resolver, FrameEncoder? frameEncoder}) → Future<RenderManifest> -
Renders
compositionforaspectintosandboxwithout touching the file system — the in-memory,dart:io-free capture-and-plan path the web encoder drives. -
resolveAudioMix(
{required Video video, required int fps, int totalFrames = 0}) → ResolvedAudioMix -
Resolves
video's declaredAudiotracks into an encoder-neutral ResolvedAudioMix for a non-FFmpeg encoder (such asfluvie_mobile_encoder). -
resolverScope(
MediaResolver? injected, {NetworkAllowlist? networkAllowlist, WebClipDecoder? clipDecoder}) → ResolverScope - Resolves the MediaResolver a render uses and the matching teardown.
-
runGuarded(
List< Future< cleanups, void onError(Object error, StackTrace stackTrace)) → Future<void> Function()>void> -
Runs each cleanup in
cleanupsin order, routing any thrown error toonErrorand never re-throwing. -
runStage<
T> (RenderPhase phase, Future< T> body()) → Future<T> -
Runs
body, stampingphaseonto any FluvieRenderException it throws (when not already stamped) so the failure records which render stage broke. -
stageResolvedAudioToSandbox(
{required List< ResolvedAudioTrack> tracks, required RenderSandbox sandbox, required AudioByteLoader loadBytes, double masterVolume = 1}) → Future<AudioMixPlan> -
Stages every resolved audio
tracksintosandboxand builds the encoderAudioMixPlan, without touching the file system. -
unknownSpecProps(
Map< String, Object?> json) → List<FluvieSpecWarning> -
Reports every property in
json(a decodedVideoSpecdocument) that Fluvie does not recognize and would silently drop, each located by its path and naming the allowed keys (with a "did you mean" hint when one is close).
Typedefs
-
AudioByteLoader
= Future<
Uint8List> Function(String source) -
Loads the bytes of an audio
sourcestring (an asset key, file path, or URL). -
AudioMixLanes
= ({FfmpegAudioMix? amix, List<
FfmpegAudioNode> nodes}) -
The encoder audio lanes a render contributes: the per-track
FfmpegAudioNodes and theFfmpegAudioMixthat combines them (nullmix = no audio). -
AudioMixStager
= Future<
AudioMixLanes> Function({required MediaResolver resolver, required Directory sandbox}) -
Stages the pre-resolved audio into the render
sandboxand returns its encoder lanes. Injected sorenderingstays independent of theaudiofeature layer: the shell wires the audio layer'sstageAudioMix, tests pass a fake. - ClipMetadata = ({double fps, int frameCount, int height, int width})
-
The probed facts a
Clipneeds to resample a source video deterministically — its frame rate, frame count, and pixel dimensions. -
FrameEncoder
= Future<
Uint8List> Function(Uint8List rgba, int width, int height) - Compresses one captured frame's raw RGBA pixels to encoder-ready bytes.
-
FramePump
= Future<
void> Function(int frame) -
Pumps the tree to frame
nand returns once that frame is fully built — the host (a widget test, the capture harness, the off-screen web/mobile driver) owns the pumping mechanics. - ProgressCallback = void Function(int completed, int total)
-
Reports capture progress:
completedoftotalframes are written. - RenderAspectResult = ({RenderConfig config, RenderManifest manifest})
-
What render returns: the captured
manifestand theconfigwhose width and height were re-derived fromAspect.sizeForfor the rendered aspect. - RenderProgressCallback = void Function(RenderProgress progress)
-
A sink for RenderProgress updates, passed to a renderer's
render(...). - ResolvedMedia = ({Uint8List bytes, String contentHash})
-
One pre-resolved media asset: its raw
bytesand thecontentHashthat keys caches and render digests. -
ResolverScope
= ({Future<
void> Function() dispose, MediaResolver resolver}) - A media resolver for one render plus the teardown that releases it.
-
SandboxFramePump
= Future<
void> Function() - Pumps the host one frame after the controller seeks.
-
SandboxMount
= Future<
void> Function(Widget tree) - Mounts a capture shell (Widget) into the host before the frame loop.
-
ShellFramePump
= Future<
void> Function() -
Pumps the host one frame after the controller seeks, so the just-seeked
frame is fully built before its pixels are read. A widget test passes
() => tester.pump(); the CLI passes its binding's pump. -
ShellMount
= Future<
void> Function(Widget tree) -
Mounts
tree(the full capture shell) into the host's element tree before the frame loop starts. A widget test passestester.pumpWidget; the CLI passes its binding's pump.
Exceptions / Errors
- FluvieEncodeException
- An encoding failure: FFmpeg (native process or wasm runtime) exited non-zero, produced no output, or could not be probed at a usable version.
- FluvieRenderException
- A render-pipeline failure: a capture that could not produce a frame, a boundary that is missing or the wrong render object, a dimension mismatch, or any other fault between the frame loop and the encoder's input.
-
A missing snapshot capability: the host has no usable Chrome/Chromium to
rasterize a
Mermaid/WebView/Htmlsource, so no raster can be produced. - FluvieSpecError
-
A serialization failure: a malformed
VideoSpecdocument, an unknown element/preset/enum name, or a Fluvie value that has no JSON form. - FluvieTimingError
- A build-time timing failure: a trigger cycle, a dangling anchor reference, a missing scope, or any other plan the resolver cannot turn into frames.