decodeSelectionModelType static method
Expects the map
to be either a charts.SelectionModelType
or a String
containing one of the following values:
action
info
Implementation
static charts.SelectionModelType? decodeSelectionModelType(
dynamic map, {
bool validate = true,
}) {
charts.SelectionModelType? result;
if (map is charts.SelectionModelType) {
result = map;
} else if (map != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/selection_model_type',
value: map,
validate: validate,
));
switch (map) {
case 'action':
result = charts.SelectionModelType.action;
break;
case 'info':
result = charts.SelectionModelType.info;
break;
default:
throw Exception('Unknown [SelectionModelType] encountered: [$map]');
}
}
return result;
}