fromMap method

void fromMap(
  1. Map<String, dynamic> m
)

Set values of this model from json map.

Implementation

void fromMap(Map<String, dynamic> m) {
  var fields = getAllFields();
  for (var f in fields) {
    if (f?.jsonMapName != null) {
      if (m.containsKey(f?.jsonMapName)) {
        try {
          var v = DbHelper._getMapValue(m[f?.jsonMapName], f!.valueType);
          f.value = v;
        } catch (e) {
          // ignore: avoid_print
          print(e);
        }
      }
    }
  }
}