StaticChartDataSource class

An in-memory, zero-boilerplate implementation of ChartDataSource.

Enables developers to feed an existing List<Candle> or JSON map data directly into Im Charts without writing custom data provider code.

Implemented types

Constructors

StaticChartDataSource(List<Candle> candles)
Creates a static data source populated with the given candles.
StaticChartDataSource.fromMapList(List<Map<String, dynamic>> rawList)
Convenient constructor to parse raw OHLCV maps (e.g. from a REST API) directly.
factory

Properties

candles → List<Candle>
Returns an unmodifiable view of current candles.
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

appendCandle(Candle candle) → void
Appends a new closed or live candle to the dataset.
dispose() → void
Disposes any active connections or timers.
override
getHistoricalData({required String symbol, required Timeframe timeframe, int count = 500, DateTime? before}) → Future<List<Candle>>
Fetches historical OHLCV bars for the specified symbol and timeframe. Optionally pass before to fetch candles older than that timestamp (for pagination).
override
getLiveTicks(String symbol) → Stream<Tick>
Real-time stream of live trades/ticks for the given symbol.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pushPrice(double price, {double volume = 1.0}) → void
Emits a live price tick with current timestamp.
pushTick(Tick tick) → void
Emits a new real-time Tick through the live stream.
toString() → String
A string representation of this object.
inherited
updateCandles(List<Candle> newCandles) → void
Replaces all candles with newCandles.

Operators

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