decodePercentInjector<D> static method

PercentInjector<D>? decodePercentInjector<D>(
  1. dynamic map, {
  2. bool validate = true,
})

Decodes the object from a Map-like dynamic structure. This expects the JSON format to be of the following structure:

{
  "totalType": <PercentInjectorTotalType>
}

Implementation

static charts.PercentInjector<D>? decodePercentInjector<D>(
  dynamic map, {
  bool validate = true,
}) {
  charts.PercentInjector<D>? result;

  if (map is charts.PercentInjector<D>) {
    result = map;
  } else if (map != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/percent_injector',
      value: map,
      validate: validate,
    ));
    result = charts.PercentInjector<D>(
      totalType: decodePercentInjectorTotalType(
            map['totalType'],
            validate: false,
          ) ??
          common.PercentInjectorTotalType.domain,
    );
  }

  return result;
}