ModelLess.fromMap constructor

ModelLess.fromMap(
  1. Map map
)

making a new model from a map

Implementation

factory ModelLess.fromMap(Map map) {
  ModelLess apiModels = ModelLess();
  map.forEach((key, value) {
    if (value is List) {
      apiModels.set(key, ModelLessArray.fromList(value));
    } else if (value is Map) {
      apiModels.set(key, ModelLess.fromMap(value));
    } else {
      apiModels.set(key, value);
    }
  });

  return apiModels;
}