toMap method

Map<String, dynamic> toMap()

Converts the ModelLess instance to a Map<String, dynamic>. Each key-value pair in the fields map is added to the resulting map. If a value is of type DateTime, it is converted to a string representation. Returns a map representation of the ModelLess instance.

Implementation

Map<String, dynamic> toMap() {
  Map<String, dynamic> f = {};
  fields.forEach((key, value) {
    if (value is DateTime) {
      f[key] = value.toString();
    } else {
      f[key] = value;
    }
  });

  return f;
}