fromMap method

String fromMap(
  1. String apiClassName,
  2. Map map,
  3. String suffix,
  4. List<ModelClassName> listClassName,
  5. String parent,
)

Implementation

String fromMap(String apiClassName, Map map, String suffix,
    List<ModelClassName> listClassName, String parent) {
  final variable = map.keys;
  return '''factory $apiClassName.fromMap(Map<String, dynamic> map,) {
  return ${variable.isEmpty ? 'const' : ''} $apiClassName(
    ${variable.map((e) => "${e.toString().camelCase}: ${getVariableFromMap(e, map[e], suffix, listClassName, parent)}").join(',      \n')}${variable.isNotEmpty ? ',' : ''}
  );
}''';
}