fromDynamic static method
Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"animate": <bool>,
"animationDuration": <Duration>,
"behaviors": <List<charts.ChartBehavior<num>>>,
"defaultInteractions": <bool>,
"defaultRenderer": <common.ArcRendererConfig<num>>,
"layoutConfig": <charts.LayoutConfig>,
"rtlSpec": <common.RTLSpec>,
"series": <List<charts.Series<dynamic, num>>>,
"selectionModels": <List<charts.SelectionModelConfig<num>>>
}
Implementation
static NumericPieChartBuilder fromDynamic(
dynamic map, {
JsonWidgetRegistry? registry,
}) {
if (map == null) {
throw Exception('[NumericPieChartBuilder]: map is null');
}
return NumericPieChartBuilder(
animate:
map['animate'] == null ? null : JsonClass.parseBool(map['animate']),
animationDuration:
JsonClass.parseDurationFromMillis(map['animationDuration']),
behaviors: JsonChartsDecoder.decodeChartBehaviorList<num>(
map['behaviors'],
validate: false,
),
defaultInteractions: JsonClass.parseBool(
map['defaultInteractions'],
whenNull: true,
),
defaultRenderer: JsonChartsDecoder.decodeArcRendererConfig<num>(
map['defaultRenderer'],
validate: false,
),
layoutConfig: JsonChartsDecoder.decodeLayoutConfig(
map['layoutConfig'],
validate: false,
),
rtlSpec: JsonChartsDecoder.decodeRTLSpec(
map['rtlSpec'],
validate: false,
),
series: JsonChartsDecoder.decodeSeriesList(
map['series'],
validate: false,
),
selectionModels: JsonChartsDecoder.decodeSelectionModelConfigList<num>(
map['selectionModels'],
validate: false,
),
);
}