|
| 1 | +## Migration guide for release 2.0.0 |
| 2 | + |
| 3 | +- Renamed `sendBy` field to `sentBy` in `Message` class. |
| 4 | + |
| 5 | +- Renamed `chatUsers` field to `otherUsers` in `ChatController` class. |
| 6 | + |
| 7 | +- Moved `currentUser` field from `ChatView` widget to `ChatController` class |
| 8 | + |
| 9 | +- Updated `id` value in `copyWith` method of `Message` to have correct value. |
| 10 | + |
| 11 | +- Removed `showTypingIndicator` field from `ChatView` and replaced it with `ChatController.showTypingIndicator`. |
| 12 | + |
| 13 | + Before: |
| 14 | + ```dart |
| 15 | + ChatView( |
| 16 | + showTypingIndicator:false, |
| 17 | + ), |
| 18 | + ``` |
| 19 | +
|
| 20 | + After: |
| 21 | + ```dart |
| 22 | + /// use it with your [ChatController] instance. |
| 23 | + _chatContoller.setTypingIndicator = true; // for showing indicator |
| 24 | + _chatContoller.setTypingIndicator = false; // for hiding indicator |
| 25 | + ``` |
| 26 | +
|
| 27 | +- Updated `ChatUser`, `Message` and `ReplyMessage` Data Model's `fromJson` and `toJson` methods: |
| 28 | +
|
| 29 | + ##### in `ChatUser.fromJson`: |
| 30 | +
|
| 31 | + Before: |
| 32 | + ```dart |
| 33 | + ChatUser.fromJson( |
| 34 | + { |
| 35 | + ... |
| 36 | + 'imageType': ImageType.asset, |
| 37 | + ... |
| 38 | + }, |
| 39 | + ), |
| 40 | + ``` |
| 41 | +
|
| 42 | + After: |
| 43 | + ```dart |
| 44 | + ChatUser.fromJson( |
| 45 | + { |
| 46 | + ... |
| 47 | + 'imageType': 'asset', |
| 48 | + ... |
| 49 | + }, |
| 50 | + ), |
| 51 | + ``` |
| 52 | +
|
| 53 | + ##### in `ChatUser.toJson`: |
| 54 | +
|
| 55 | + Before: |
| 56 | + ```dart |
| 57 | + { |
| 58 | + ... |
| 59 | + imageType: ImageType.asset, |
| 60 | + ... |
| 61 | + } |
| 62 | + ``` |
| 63 | +
|
| 64 | + After: |
| 65 | + ```dart |
| 66 | + { |
| 67 | + ... |
| 68 | + imageType: asset, |
| 69 | + ... |
| 70 | + } |
| 71 | + ``` |
| 72 | +
|
| 73 | + ##### in `Message.fromJson`: |
| 74 | +
|
| 75 | + Before: |
| 76 | + ```dart |
| 77 | + Message.fromJson( |
| 78 | + { |
| 79 | + ... |
| 80 | + 'createdAt': DateTime.now(), |
| 81 | + 'message_type': MessageType.text, |
| 82 | + 'voice_message_duration': Duration(seconds: 5), |
| 83 | + ... |
| 84 | + } |
| 85 | + ) |
| 86 | + ``` |
| 87 | +
|
| 88 | + After: |
| 89 | + ```dart |
| 90 | + Message.fromJson( |
| 91 | + { |
| 92 | + ... |
| 93 | + 'createdAt': '2024-06-13T17:32:19.586412', |
| 94 | + 'message_type': 'text', |
| 95 | + 'voice_message_duration': '5000000', |
| 96 | + ... |
| 97 | + } |
| 98 | + ) |
| 99 | + ``` |
| 100 | +
|
| 101 | + ##### in `Message.toJson`: |
| 102 | +
|
| 103 | + Before: |
| 104 | + ```dart |
| 105 | + { |
| 106 | + ... |
| 107 | + createdAt: 2024-06-13 17:23:19.454789, |
| 108 | + message_type: MessageType.text, |
| 109 | + voice_message_duration: 0:00:05.000000, |
| 110 | + ... |
| 111 | + } |
| 112 | + ``` |
| 113 | +
|
| 114 | + After: |
| 115 | + ```dart |
| 116 | + { |
| 117 | + ... |
| 118 | + createdAt: 2024-06-13T17:32:19.586412, |
| 119 | + message_type: text, |
| 120 | + voice_message_duration: 5000000, |
| 121 | + ... |
| 122 | + } |
| 123 | + ``` |
| 124 | +
|
| 125 | + ##### in `ReplyMessage.fromJson`: |
| 126 | +
|
| 127 | + Before: |
| 128 | + ```dart |
| 129 | + ReplyMessage.fromJson( |
| 130 | + { |
| 131 | + ... |
| 132 | + 'message_type': MessageType.text, |
| 133 | + 'voiceMessageDuration': Duration(seconds: 5), |
| 134 | + ... |
| 135 | + } |
| 136 | + ) |
| 137 | + ``` |
| 138 | +
|
| 139 | + After: |
| 140 | + ```dart |
| 141 | + ReplyMessage.fromJson( |
| 142 | + { |
| 143 | + ... |
| 144 | + 'message_type': 'text', |
| 145 | + 'voiceMessageDuration': '5000000', |
| 146 | + ... |
| 147 | + } |
| 148 | + ) |
| 149 | + ``` |
| 150 | +
|
| 151 | + in `ReplyMessage.toJson`: |
| 152 | +
|
| 153 | + Before: |
| 154 | + ```dart |
| 155 | + { |
| 156 | + ... |
| 157 | + message_type: MessageType.text, |
| 158 | + voiceMessageDuration: 0:00:05.000000, |
| 159 | + ... |
| 160 | + } |
| 161 | + ``` |
| 162 | +
|
| 163 | + After: |
| 164 | + ```dart |
| 165 | + { |
| 166 | + ... |
| 167 | + message_type: text, |
| 168 | + voiceMessageDuration: 5000000, |
| 169 | + ... |
| 170 | + } |
| 171 | + ``` |
0 commit comments