ExportableChartController class

Wraps a chart widget in a RepaintBoundary with a managed GlobalKey.

Call ExportableChartController.capture() to get PNG bytes.

final ctrl = ExportableChartController();

ExportableChart(
  controller: ctrl,
  child: TenunChart(config: myConfig),
)

// Later:
final bytes = await ctrl.capture();

Constructors

ExportableChartController()

Properties

boundaryKey GlobalKey<State<StatefulWidget>>
Repaint boundary key managed by ExportableChart.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

capture({double pixelRatio = 2.0}) Future<Uint8List?>
captureBytes({ChartImageExportFormat format = ChartImageExportFormat.png, double pixelRatio = 2.0, int jpegQuality = 90, Color jpegBackgroundColor = Colors.white}) Future<Uint8List?>
captureImage({double pixelRatio = 2.0}) Future<Image?>
captureJpeg({double pixelRatio = 2.0, int quality = 90, Color backgroundColor = Colors.white}) Future<Uint8List?>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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