FluentChartImageExporter class

Renders a chart and its synthesised legend into a PNG data URL.

Ports exportChartsAsImage + svgToPng (image-export-utils.ts:32-80, 400-459) against a RepaintBoundary instead of a cloned SVG. The grid is always one column: the chart on row 0 and, when there are legends, the strip on row 1 — which is exactly what :75 pushes.

There is no RenderRepaintBoundary.toImage precedent elsewhere in this package; this class is the pattern every future chart export should follow. Both toImage and ui.Image.toByteData are serviced by the engine, so a widget test must call toImage inside WidgetTester.runAsync.

Constructors

FluentChartImageExporter({required GlobalKey<State<StatefulWidget>> boundaryKey, required List<FluentChartLegendItem> legends, FluentChartTextMeasurer? measurer, TextStyle legendTextStyle = const TextStyle(fontSize: 12), Set<String> selectedLegends = const <String>{}, bool centerLegends = false, bool isRtl = false, double? clipHeight, GlobalKey<State<StatefulWidget>>? continuationKey, double continuationX = 0})
Creates an exporter over the boundary at boundaryKey.

Properties

boundaryKey → GlobalKey<State<StatefulWidget>>
Key of the RepaintBoundary wrapping the painted chart.
final
centerLegends → bool
Whether the strip is centred under the chart.
final
clipHeight → double?
Logical height of boundaryKey's box to keep, measured from its top. Null keeps all of it.
final
continuationKey → GlobalKey<State<StatefulWidget>>?
A second boundary, captured whole and drawn directly below the kept part of boundaryKey, continuationX in from its left edge.
final
continuationX → double
Left edge of continuationKey, in boundaryKey's logical coordinates.
final
hashCode → int
The hash code for this object.
no setterinherited
isRtl → bool
Whether the strip lays out right to left.
final
legends → List<FluentChartLegendItem>
Legends to synthesise. Empty means no strip is drawn at all, which is what hideLegends does at hooks.ts:33 — the argument hideLegends ? undefined : legendsRef.current?.toSVG, which is what exportChartsAsImage receives in place of a legend cloner. :32 is the chart-container argument above it.
final
legendTextStyle → TextStyle
Text style for the legend labels.
final
measurer → FluentChartTextMeasurer
Measurer for the legend labels.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedLegends → Set<String>
Legends currently selected; empty means every legend is drawn active.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toImage([FluentChartImageExportOptions options = const FluentChartImageExportOptions()]) → Future<String>
Renders the chart to a data:image/png;base64,… string.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited