fetchOptionDetails method
- required String underlyingSymbolId,
override
Option contracts for the underlying symbol's chain.
The first element of the array must be the underlying symbol info
(no optType field). The chart uses it to resolve the correct spot price
regardless of which underlying the option chain belongs to.
All subsequent elements are option contracts.
Shape:
[
{
"id": "NIFTY",
"name": "NIFTY 50",
"lotSize": 50,
"precision": 2,
"tickSize": 0.05
},
{
"id": "NIFTY25MAR23000CE",
"name": "NIFTY 23000 CE Mar 27",
"strike": 23000,
"expiry": "2025-03-27",
"optType": "CE",
"lotSize": 50,
"precision": 2,
"tickSize": 0.05
"exchange": "MCX"
},
...
]
Return an empty array "[]" when no option chain is active.
Implementation
@override
Future<String> fetchOptionDetails({
required String underlyingSymbolId,
}) async {
final result = await _data.invokeMethod<String>(
'fetchOptionDetails',
{'underlyingSymbolId': underlyingSymbolId},
);
return result ?? '[]';
}