decodeClip static method

Clip? decodeClip(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the value to a Clip. Supported values are:

  • antiAlias
  • antiAliasWithSaveLayer
  • hardEdge
  • none

Implementation

static Clip? decodeClip(
  dynamic value, {
  bool validate = true,
}) {
  Clip? result;

  if (value is Clip) {
    result = value;
  } else {
    _checkSupported(
      'Clip',
      [
        'antiAlias',
        'antiAliasWithSaveLayer',
        'hardEdge',
        'none',
      ],
      value,
    );

    if (value != null) {
      assert(SchemaValidator.validate(
        schemaId: '$_baseSchemaUrl/clip',
        value: value,
        validate: validate,
      ));
      switch (value) {
        case 'antiAlias':
          result = Clip.antiAlias;
          break;
        case 'antiAliasWithSaveLayer':
          result = Clip.antiAliasWithSaveLayer;
          break;
        case 'hardEdge':
          result = Clip.hardEdge;
          break;
        case 'none':
          result = Clip.none;
          break;
      }
    }
  }

  return result;
}