decodeBorderRadiusGeometry static method

BorderRadius? decodeBorderRadiusGeometry(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value to a BorderRadius. The value may be a String, an int, a double, or a Map-like object.

When the value is a String, int, or double then the value will be parsed via JsonClass.maybeParseDouble and the result will be passed to BorderRadius.circular.

If the value is a Map-like object then the expected structure depends on on the value passed in for the "type" attribute. The expected "type" values must be one of:

  • all
  • circular
  • horizontal
  • only
  • vertical

Type: all expects a structure:

{
  "radius": "<Radius>",
  "type": "all"
}

Type: circular expects a structure:

{
  "radius": "<double>",
  "type": "circular"
}

Type: horizontal expects a structure:

{
  "left": "<Radius>",
  "right": "<Radius>",
  "type": "horizontal"
}

Type: only expects a structure:

{
  "bottomLeft": "<Radius>",
  "bottomRight": "<Radius>",
  "topLeft": "<Radius>",
  "topRight": "<Radius>",
  "type": "only"
}

Type: vertical expects a structure:

{
  "bottom": "<Radius>",
  "top": "<Radius>",
  "type": "vertical"
}

See also:

Implementation

static BorderRadius? decodeBorderRadiusGeometry(
  dynamic value, {
  bool validate = true,
}) =>
    decodeBorderRadius(value, validate: validate);