fromDynamic static method

JsonFractionallySizedBoxBuilder? 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>,
  "heightFactor": <double>,
  "widthFactor": <double>
}

See also:

  • ThemeDecoder.decodeAlignment

Implementation

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

  if (map != null) {
    result = JsonFractionallySizedBoxBuilder(
      alignment: ThemeDecoder.decodeAlignment(
            map['alignment'],
            validate: false,
          ) ??
          Alignment.center,
      heightFactor: JsonClass.parseDouble(
        map['heightFactor'],
      ),
      widthFactor: JsonClass.parseDouble(
        map['widthFactor'],
      ),
    );
  }

  return result;
}