upload_profile_image_repsonse.model.dart 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import 'dart:convert';
  2. class UploadProfileImageResponse {
  3. final String userId;
  4. final String profileImagePath;
  5. UploadProfileImageResponse({
  6. required this.userId,
  7. required this.profileImagePath,
  8. });
  9. UploadProfileImageResponse copyWith({
  10. String? userId,
  11. String? profileImagePath,
  12. }) {
  13. return UploadProfileImageResponse(
  14. userId: userId ?? this.userId,
  15. profileImagePath: profileImagePath ?? this.profileImagePath,
  16. );
  17. }
  18. Map<String, dynamic> toMap() {
  19. final result = <String, dynamic>{};
  20. result.addAll({'userId': userId});
  21. result.addAll({'profileImagePath': profileImagePath});
  22. return result;
  23. }
  24. factory UploadProfileImageResponse.fromMap(Map<String, dynamic> map) {
  25. return UploadProfileImageResponse(
  26. userId: map['userId'] ?? '',
  27. profileImagePath: map['profileImagePath'] ?? '',
  28. );
  29. }
  30. String toJson() => json.encode(toMap());
  31. factory UploadProfileImageResponse.fromJson(String source) =>
  32. UploadProfileImageResponse.fromMap(json.decode(source));
  33. @override
  34. String toString() =>
  35. 'UploadProfileImageReponse(userId: $userId, profileImagePath: $profileImagePath)';
  36. @override
  37. bool operator ==(Object other) {
  38. if (identical(this, other)) return true;
  39. return other is UploadProfileImageResponse &&
  40. other.userId == userId &&
  41. other.profileImagePath == profileImagePath;
  42. }
  43. @override
  44. int get hashCode => userId.hashCode ^ profileImagePath.hashCode;
  45. }