fromDynamic static method
Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"addAutomaticKeepAlives": <bool>,
"addRepaintBoundaries": <bool>,
"addSemanticIndexes": <bool>,
"findChildIndexCallback": <ChildIndexGetter>,
"semanticIndexCallback": <SemanticIndexCallback>,
"semanticIndexOffset": <int>
}
As a note, the ScrollController 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 JsonSliverListBuilder? fromDynamic(
dynamic map, {
JsonWidgetRegistry? registry,
}) {
JsonSliverListBuilder? result;
if (map != null) {
result = JsonSliverListBuilder(
addAutomaticKeepAlives: JsonClass.parseBool(
map['addAutomaticKeepAlives'],
whenNull: true,
),
addRepaintBoundaries: JsonClass.parseBool(
map['addRepaintBoundaries'],
whenNull: true,
),
addSemanticIndexes: JsonClass.parseBool(
map['addSemanticIndexes'],
whenNull: true,
),
findChildIndexCallback: map['findChildIndexCallback'],
semanticIndexCallback: map['semanticIndexCallback'],
semanticIndexOffset:
JsonClass.parseInt(map['semanticIndexOffset']) ?? 0,
);
}
return result;
}