fromDynamic static method

JsonStackBuilder? 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>,
  "clipBehavior": <Clip>,
  "fit": <StackFit>,
  "textDirection": <TextDirection>
}

See also:

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

Implementation

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

  if (map != null) {
    result = JsonStackBuilder(
      alignment: ThemeDecoder.decodeAlignment(
            map['alignment'],
            validate: false,
          ) ??
          AlignmentDirectional.topStart,
      clipBehavior: ThemeDecoder.decodeClip(
            map['clipBehavior'],
            validate: false,
          ) ??
          Clip.hardEdge,
      fit: ThemeDecoder.decodeStackFit(
            map['fit'],
            validate: false,
          ) ??
          StackFit.loose,
      textDirection: ThemeDecoder.decodeTextDirection(
        map['textDirection'],
        validate: false,
      ),
    );
  }

  return result;
}