fromDynamic static method
Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"automaticallyInheritForPlatforms": "<List<TargetPlatform>>",
"controller": "<ScrollController>",
"debugLabel": "<String>",
"initialScrollOffset": "<double>",
"keepScrollOffset": "<bool>",
"scrollDirection": "<Axis>"
}
Where the value of the key
attribute is the key used on the
JsonWidgetRegistry.setValue to store the current ScrollController.
Implementation
static JsonPrimaryScrollControllerBuilder? fromDynamic(
dynamic map, {
JsonWidgetRegistry? registry,
}) {
JsonPrimaryScrollControllerBuilder? result;
if (map != null) {
result = JsonPrimaryScrollControllerBuilder(
automaticallyInheritForPlatforms: Set<TargetPlatform>.from(
(map['automaticallyInheritForPlatforms'] as Iterable?)
?.map((e) => ThemeDecoder.decodeTargetPlatform(
e,
validate: false,
)!)
.toList() ??
[
TargetPlatform.android,
TargetPlatform.iOS,
TargetPlatform.fuchsia,
],
),
debugLabel: map['debugLabel'],
initialScrollOffset:
JsonClass.maybeParseDouble(map['initialScrollOffset']),
keepScrollOffset: JsonClass.parseBool(
map['keepScrollOffset'],
whenNull: true,
),
scrollDirection: ThemeDecoder.decodeAxis(
map['scrollDirection'],
validate: false,
) ??
Axis.vertical,
);
}
return result;
}