FinancialChart class

A financial chart: candlestick, OHLC, line, area, or volume, rendered entirely with CustomPainter — no per-candle widgets.

FinancialChart does not assume it owns the whole screen; it expects bounded layout constraints from its parent (the same requirement any CustomPaint-based chart has), so wrap it in a SizedBox, Expanded, or similar when the parent would otherwise offer unbounded space.

FinancialChart(
  data: candles,
  type: FinancialChartType.candlestick,
  controller: controller,
  config: FinancialChartConfig(
    showGrid: true,
    enablePan: true,
    enableZoom: true,
    crosshair: CrosshairConfig(enabled: true),
  ),
)

The package accepts market data and knows nothing about where it came from — no REST/WebSocket/broker/backend concerns live here. See normalizeCandleData for exactly how malformed input is handled.

Inheritance

Constructors

FinancialChart({required List<Candle> data, FinancialChartType type = FinancialChartType.candlestick, FinancialChartController? controller, FinancialChartConfig config = const FinancialChartConfig(), FinancialChartThemeData? theme, ValueChanged<List<String>>? onDataIssues, WidgetBuilder? emptyStateBuilder, Key? key})
Creates a financial chart.
const

Properties

config FinancialChartConfig
Chart behavior and feature configuration.
final
controller FinancialChartController?
Optional programmatic control over the viewport. If omitted, the chart creates and manages its own controller internally.
final
data List<Candle>
The candle series to render, ideally already sorted ascending by timestamp. See normalizeCandleData for how out-of-order, duplicate, or malformed entries are handled.
final
emptyStateBuilder WidgetBuilder?
Builds the widget shown when data is empty. Defaults to a centered "No data" message styled from theme.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDataIssues ValueChanged<List<String>>?
Called with a human-readable description of each correction applied while sanitizing data (see normalizeCandleData), whenever data changes. Optional — most applications that supply well-formed data will never see this called.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
theme FinancialChartThemeData?
The visual theme. Defaults to FinancialChartThemeData.dark.
final
type FinancialChartType
Which chart type to render.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<FinancialChart>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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