fromDynamic static method
Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"alignment": <AlignmentGeometry>,
"curve": <Curve>,
"duration": <int; millis>,
"heightFactor": <double>,
"onEnd": <VoidCallback>,
"widthFactor": <double>
}
As a note, the Curve and VoidCallback cannot be decoded via JSON. Instead, the only way to bind those values to the builder is to use a function or a variable reference via the JsonWidgetRegistry.
Implementation
static JsonAnimatedAlignBuilder? fromDynamic(
dynamic map, {
JsonWidgetRegistry? registry,
}) {
JsonAnimatedAlignBuilder? result;
if (map != null) {
result = JsonAnimatedAlignBuilder(
alignment: ThemeDecoder.decodeAlignment(
map['alignment'],
validate: false,
)!,
curve: map['curve'] ?? Curves.linear,
duration: JsonClass.parseDurationFromMillis(
map['duration'],
)!,
heightFactor: JsonClass.parseDouble(map['heightFactor']),
onEnd: map['onEnd'],
widthFactor: JsonClass.parseDouble(map['widthFactor']),
);
}
return result;
}