import 'dart:io'; import 'package:test_sa/controllers/api_routes/urls.dart'; import 'package:test_sa/models/lookup.dart'; class GenericAttachmentModel { GenericAttachmentModel({this.id, this.name, this.originalName, this.createdBy, this.documentTypeId}); int? id; String? name; String? createdBy; String? originalName; Lookup? documentTypeId; GenericAttachmentModel.fromJson(Map json, {bool convertToLink = false}) { id = json['id']; name = json['name'] ?? json['imageName']; createdBy = json['createdBy']; originalName = json['originalName'] ?? json['imageOriginalName']; if (convertToLink) { name = URLs.getFileUrl(name); } } Map toJson() { final Map data = {}; data['id'] = id; data['name'] = name; data['createdBy'] = createdBy; data['originalName'] = originalName; return data; } }