fromDynamic static method
Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"autovalidateMode": "<AutovalidateMode>",
"onChanged": "<VoidCallback>",
"onWillPop": "<WillPopCallback>"
}
As a note, the VoidCallback and WillPopCallback 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.
See also:
- buildCustom
ThemeDecoder.decodeAutovalidateMode
Implementation
static JsonFormBuilder? fromDynamic(
dynamic map, {
JsonWidgetRegistry? registry,
}) {
JsonFormBuilder? result;
if (map != null) {
result = JsonFormBuilder(
autovalidateMode: map['autovalidate'] == null
? ThemeDecoder.decodeAutovalidateMode(
map['autovalidateMode'],
validate: false,
)
: JsonClass.parseBool(map['autovalidate']) == true
? AutovalidateMode.always
: AutovalidateMode.disabled,
onChanged: map['onChanged'],
onWillPop: map['onWillPop'],
);
}
return result;
}