-
-
Notifications
You must be signed in to change notification settings - Fork 77
Closed
Labels
featureNew feature or requestNew feature or request
Description
In the code we have that eventually emits json ... everything pops out as a string ... like in this fontSize
"child": {
"data": "Home",
"style": { "fontSize": "24" },
"type": "text"
},
"type": "center"
Just to get past this one scenario, I tweaked the StacTextStyle fromJson to handle this. Can you all thing of a more clever way to handle this?
static StacTextStyle _fromJson(dynamic json) {
if (json is String) {
return _$StacTextStyleFromJson({"styleFromTheme": json});
} else if (json is Map<String, dynamic>) {
// if string, try parsing !!!!!!!!!!!!!!!!!!!!
if (json['fontSize'] is String) {
json['fontSize'] = double.tryParse(json['fontSize']);
}
return _$StacTextStyleFromJson(json);
}
return _$StacTextStyleFromJson({});
}
Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or request