fromDynamic static method

JsonWrapBuilder? 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": <WrapAlignment>,
  "clipBehavior": <Clip>,
  "crossAxisAlignment": <WrapCrossAlignment>,
  "direction": <Axis>,
  "runAlignment": <WrapAlignment>,
  "runSpacing": <double>,
  "spacing": <double>,
  "textDirection": <TextDirection>,
  "verticalDirection": <VerticalDirection>
}

See also:

  • ThemeDecoder.decodeAxis
  • ThemeDecoder.decodeClip
  • ThemeDecoder.decodeTextDirection
  • ThemeDecoder.decodeWrapAlignment
  • ThemeDecoder.decodeVerticalDirection
  • ThemeDecoder.decodeWrapCrossAlignment

Implementation

static JsonWrapBuilder? fromDynamic(
  dynamic map, {
  JsonWidgetRegistry? registry,
}) {
  JsonWrapBuilder? result;
  if (map != null) {
    result = JsonWrapBuilder(
      alignment: ThemeDecoder.decodeWrapAlignment(map['alignment']),
      clipBehavior: ThemeDecoder.decodeClip(map['clipBehavior']),
      crossAxisAlignment: ThemeDecoder.decodeWrapCrossAlignment(
        map['crossAxisAlignment'],
      ),
      direction: ThemeDecoder.decodeAxis(map['axis']),
      runAlignment: ThemeDecoder.decodeWrapAlignment(map['runAlignment']),
      spacing: JsonClass.parseDouble(map['spacing']),
      runSpacing: JsonClass.parseDouble(map['runSpacing']),
      textDirection: ThemeDecoder.decodeTextDirection(map['textDirection']),
      verticalDirection: ThemeDecoder.decodeVerticalDirection(
        map['verticalDirection'],
      ),
    );
  }

  return result;
}