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