decodeInitialSelection<D> static method
Decodes the object from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"selectedDataConfig": <List<SeriesDatumConfig>>,
"selectedSeriesConfig": <List<String>>,
"selectionModelType": <SelectionModelType>,
"shouldPreserveSelectionOnDraw": <bool>
}
See also
Implementation
static charts.InitialSelection<D>? decodeInitialSelection<D>(
dynamic map, {
bool validate = false,
}) {
charts.InitialSelection<D>? result;
if (map is charts.InitialSelection<D>) {
result = map;
} else if (map != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/initial_selection',
value: map,
validate: validate,
));
result = charts.InitialSelection<D>(
selectedDataConfig: decodeSeriesDatumConfigList(
map['selectedDataConfig'],
validate: false,
),
selectedSeriesConfig: map['selectedSeriesConfig'] == null
? null
: List<String>.from(map['selectedSeriesConfig']),
selectionModelType: decodeSelectionModelType(
map['selectionModelType'],
validate: false,
) ??
common.SelectionModelType.info,
shouldPreserveSelectionOnDraw: JsonClass.parseBool(
map['shouldPreserveSelectionOnDraw'],
),
);
}
return result;
}