fromJson method

void fromJson(
  1. Map<String, dynamic> json
)

Чтение полей объекта из JSON

Implementation

void fromJson(Map<String, dynamic> json) {
  json.forEach((name, jsonValue) {
    if (name == usVisible) {
      visible = (jsonValue.toString().toLowerCase() == 'true' || jsonValue.toString().toLowerCase() == '1');
    }
    if (name == usWidth) {
      if (jsonValue is int) {
        width = jsonValue.toDouble();
      } else {
        width = jsonValue;
      }
    }
    if (name == usPresentation) {
      presentation = jsonValue;
    }
    if (name == usFlex) {
      flex = jsonValue;
    }
  });
}