translate static method
Implementation
static XView translate(Map<String, dynamic> data) {
/// handle by type
/// -> since dart does not support generic instance de-serialization, we should handle the dynamic remote ui via some custom mapping.
final String fieldType = data["type"] as String;
final fieldData = data;
// the field data's type must be json serializable type, which is currently -> `Map<String, dynamic>`
// assert(fieldData.runtimeType is Map<String, dynamic>);
// region button
if (fieldType == "button") {
// return XButton.fromJson(fieldData);
}
// endregion button
// region text
if (fieldType == "text") {
// return XText.fromJson(fieldData);
}
// endregion text
// region avatar
if (fieldType == "avatar") {}
// endregion avatar
return XView(key: "", type: "");
}