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