data property
JsonWidgetData
get
data
Implementation
JsonWidgetData get data {
if (_data == null) {
var data = _registry.processArgs(_key, null).value;
if (data is! JsonWidgetData) {
data = JsonWidgetData.fromDynamic(
data,
registry: registry,
);
}
if (data is! JsonWidgetData) {
throw Exception(
'Unable to find JsonWidgetData via [$_key] on the registry',
);
}
// It's an error for two exact JsonWidgetData objects to be in two places
// on the tree. To avoid that, we recreate the data object to effectively
// clone it so it's a copy that gets placed on the tree and not the exact
// widget. Plus, this way the widget picks up any current dynamic values
// rather than the outdated ones it might have been set up with.
_data = data.recreate(registry);
}
return _data!;
}