import 'file.model.dart'; class CompanyModel { CompanyModel({ required this.id, required this.createdAt, required this.updatedAt, required this.name, required this.isDelete, required this.files, }); final int? id; final DateTime? createdAt; final DateTime? updatedAt; final String? name; final int? isDelete; final List files; factory CompanyModel.fromJson(Map json) { return CompanyModel( id: json["id"], createdAt: DateTime.tryParse(json["createdAt"] ?? ""), updatedAt: DateTime.tryParse(json["updatedAt"] ?? ""), name: json["name"], isDelete: json["isDelete"], files: json["files"] == null ? [] : List.from( json["files"]!.map((x) => FileModel.fromJson(x))), ); } Map toJson() => { "id": id, "createdAt": createdAt?.toIso8601String(), "updatedAt": updatedAt?.toIso8601String(), "name": name, "isDelete": isDelete, "files": files.map((x) => x.toJson()).toList(), }; }