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