fromDynamic static method

JsonIndexedStackBuilder? 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": <Alignment>,
  "index": <int>,
  "sizing": <StackFit>,
  "textDirection": <TextDirection>
}

See also:

  • ThemeDecoder.decodeAlignment
  • ThemeDecoder.decodeStackFit
  • ThemeDecoder.decodeTextDirection

Implementation

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

  if (map != null) {
    result = JsonIndexedStackBuilder(
      alignment: ThemeDecoder.decodeAlignment(
            map['alignment'],
            validate: false,
          ) ??
          AlignmentDirectional.topStart,
      index: JsonClass.parseInt(map['index'], 0),
      sizing: ThemeDecoder.decodeStackFit(
            map['sizing'],
            validate: false,
          ) ??
          StackFit.loose,
      textDirection: ThemeDecoder.decodeTextDirection(
        map['textDirection'],
        validate: false,
      ),
    );
  }

  return result;
}