fromDynamic static method

JsonOverflowBoxBuilder? fromDynamic(
  1. dynamic map, {
  2. JsonWidgetRegistry? registry,
})

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

{
  "alignment": <AlignmentGeometry>,
  "maxHeight": <double>,
  "maxWidth": <double>,
  "minHeight": <double>,
  "minWidth": <double>
}

See also:

  • ThemeDecoder.decodeAlignment

Implementation

static JsonOverflowBoxBuilder? fromDynamic(
  dynamic map, {
  JsonWidgetRegistry? registry,
}) {
  JsonOverflowBoxBuilder? result;

  if (map != null) {
    result = JsonOverflowBoxBuilder(
      alignment: ThemeDecoder.decodeAlignment(
            map['alignment'],
          ) ??
          Alignment.center,
      maxHeight: JsonClass.parseDouble(
        map['maxHeight'],
      ),
      maxWidth: JsonClass.parseDouble(
        map['maxWidth'],
      ),
      minHeight: JsonClass.parseDouble(
        map['minHeight'],
      ),
      minWidth: JsonClass.parseDouble(
        map['minWidth'],
      ),
    );
  }

  return result;
}