ChartController class

Public controller bound to a single NativeChartView.

Routing rules:

  • candle data -> FFI (zero-copy push_candles_raw)
  • series type -> FFI
  • style (incl. label) -> FFI (chart_engine_set_style)
  • hover / tap dismissal -> FFI (chart_engine_set_hover)
  • native UI sync -> done natively, by the overlay polling the engine's style_revision, viewport_revision, generation, and hover. NOT via MethodChannel.

The per-view MethodChannel is only ever used once, by NativeChartView, for the getEngineHandle handshake. After that handshake, this controller talks to the engine exclusively through dart:ffi, and the Flutter main isolate stops being on the chart's hot path.

Inheritance

Constructors

ChartController({ChartStyle? style, double? layoutWidth, double? layoutHeight})

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isAttached → bool
no setter
layoutHeight → double?
no setter
layoutWidth → double?
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
seriesType → SeriesType
no setter
style → ChartStyle
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
attachHandle(int handle, int viewId) → void
Internal: bind to a native engine handle reported by the PlatformView. viewId is accepted for symmetry but no longer used — there is no per-view MethodChannel on the controller side now that all updates flow via FFI.
clearHover() → void
Clears any active hover/tooltip on the native side.
detachHandle() → void
dispose() → void
Discards any resources used by the object.
override
loadCandles(List<Candle> candles) → void
Convenience for List<Candle>. Packs into the engine's persistent staging buffer with no per-push allocation after the first call.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pushCandlesRaw(Float64List data) → void
Zero-copy ingestion. Engine memcpy-copies the buffer in a single shot. Recommended for streaming / large datasets.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setLayoutHeight(double? height) → void
Height for NativeChartView in logical pixels. Null yields height from parent constraints only.
setLayoutWidth(double? width) → void
Width for NativeChartView in logical pixels. Null yields width from parent constraints only.
setSeriesType(SeriesType type) → void
Switches the GPU series geometry (candle / line / area) and updates the engine-side series label to match. Users that want a custom legend label should call setStyle with copyWith(seriesLabel: ...) afterwards.
setStyle(ChartStyle style) → void
Updates the chart style. The entire visual configuration (colors, paddings, geometry, toggles, tick density, formatting, series label) is shipped to the engine via a single FFI call. The native overlay (axis labels, legend, tooltip) repaints itself on its own when it notices the engine's style_revision changed — Flutter main thread is never involved.
setTimeframe(Duration interval) → void
Candle bucket width for updateLivePrice. Mirrors the native default (60000) until you override.
toString() → String
A string representation of this object.
inherited
updateLiveOhlc({required double timestamp, required double open, required double high, required double low, required double close, double volume = 0}) → void
Full OHLCV when upstream already aggregates bars (candles use all fields; line/area still plot close).
updateLivePrice({required double price, required double timestamp, double volume = 0}) → void
High-frequency trade quote path: mutates OHLC (open unchanged, price refreshes close and pushes high/low) for candle mode; line/area redraw from close only.

Operators

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