decodeTickLabelJustification static method

TickLabelJustification? decodeTickLabelJustification(
  1. dynamic map, {
  2. bool validate = true,
})

Expects the map to be either a charts.TickLabelJustification or a String containing one of the following values:

  • inside
  • outside

Implementation

static charts.TickLabelJustification? decodeTickLabelJustification(
  dynamic map, {
  bool validate = true,
}) {
  charts.TickLabelJustification? result;

  if (map is charts.TickLabelJustification) {
    result = map;
  } else if (map != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/tick_label_justification',
      value: map,
      validate: validate,
    ));

    switch (map) {
      case 'inside':
        result = charts.TickLabelJustification.inside;
        break;

      case 'outside':
        result = charts.TickLabelJustification.outside;
        break;

      default:
        throw Exception(
          '[decodeTickLabelJustification]: map is not supported: [$map]',
        );
    }
  }

  return result;
}