decodeFontFeature static method

FontFeature? decodeFontFeature(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value to an FontFeature. This expects the given value to follow the structure below:

{
  "feature": <String>,
  "value": <int>
}

Implementation

static FontFeature? decodeFontFeature(
  dynamic value, {
  bool validate = true,
}) {
  FontFeature? result;

  if (value is FontFeature) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/font_feature',
      value: value,
      validate: validate,
    ));
    result = FontFeature(
      value['feature'],
      JsonClass.parseInt(value['value'])!,
    );
  }

  return result;
}