decodeFontVariation static method

FontVariation? decodeFontVariation(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value into a FontVariation. If the value is null then null will be returned.

This expects the format:

{
  "axis": "<String>",
  "value": "<double>"
}

Implementation

static FontVariation? decodeFontVariation(
  dynamic value, {
  bool validate = true,
}) {
  FontVariation? result;

  if (value is FontVariation) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/font_variation',
      value: value,
      validate: validate,
    ));
    result = FontVariation(
      value['axis'],
      JsonClass.parseDouble(value['value']),
    );
  }

  return result;
}