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