call_model.dart 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import 'package:youtube/data/models/user_model.dart';
  2. class CallModel {
  3. late String id;
  4. String? token;
  5. String? channelName;
  6. String? callerId;
  7. String? callerName;
  8. String? callerAvatar;
  9. String? receiverId;
  10. String? receiverName;
  11. String? receiverAvatar;
  12. String? status;
  13. num? createAt;
  14. bool? current;
  15. UserModel? otherUser; //UI
  16. CallModel(
  17. {required this.id,
  18. this.callerId,
  19. this.callerName,
  20. this.callerAvatar,
  21. this.receiverId,
  22. this.receiverName,
  23. this.receiverAvatar,
  24. this.status,
  25. this.createAt,this.current});
  26. CallModel.fromJson(Map<String, dynamic> json) {
  27. id = json['id'];
  28. token = json['token'];
  29. channelName = json['channelName'];
  30. callerId = json['callerId'];
  31. callerName = json['callerName'];
  32. callerAvatar = json['callerAvatar'];
  33. receiverId = json['receiverId'];
  34. receiverName = json['receiverName'];
  35. receiverAvatar = json['receiverAvatar'];
  36. status = json['status'];
  37. createAt = json['createAt'];
  38. current = json['current'];
  39. }
  40. Map<String, dynamic> toMap() {
  41. return {
  42. 'id': id,
  43. 'token': token,
  44. 'channelName': channelName,
  45. 'callerId': callerId,
  46. 'callerName': callerName,
  47. 'callerAvatar': callerAvatar,
  48. 'receiverId': receiverId,
  49. 'receiverName': receiverName,
  50. 'receiverAvatar': receiverAvatar,
  51. 'status': status,
  52. 'createAt': createAt,
  53. 'current': current
  54. };
  55. }
  56. }