toMap method

Map<String, dynamic> toMap()

Converts this instance to a Map<String,dynamic>, containing the current fields values.

Implementation

Map<String, dynamic> toMap() {
  var jsonMap = <String, dynamic>{};

  var fields = getObjectFields();
  var fieldsValues = getObjectValues();

  var fieldsValuesLength = fieldsValues.length;

  for (var i = 0; i < fields.length; ++i) {
    var k = fields[i];
    var v = i < fieldsValuesLength ? fieldsValues[i] : null;
    jsonMap[k] = v;
  }

  return jsonMap;
}