decodeNumericExtents static method

NumericExtents? decodeNumericExtents(
  1. dynamic map, {
  2. bool validate = false,
})

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

{
  "max": <double>,
  "min": <double>
}

Implementation

static common.NumericExtents? decodeNumericExtents(
  dynamic map, {
  bool validate = false,
}) {
  common.NumericExtents? result;

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

    result = common.NumericExtents(
      JsonClass.parseInt(map['min'])!,
      JsonClass.parseInt(map['max'])!,
    );
  }

  return result;
}