batch.fetchMessages with `includeUUID: false` raises null exception
linsdev opened this issue · 1 comments
linsdev commented
final pubnub = PubNub(...);
pubnub.batch.fetchMessages('channelName', includeUUID: false);
batch.fetchMessages
with parameter includeUUID: false
failed because BatchHistoryResultEntry.fromJson
not check includeUUID parameter.
BatchHistoryResultEntry.fromJson
constructor from /lib/src/dx/_endpoints/history.dart:
class BatchHistoryResultEntry {
...
/// UUID of the sender.
String uuid;
...
factory BatchHistoryResultEntry.fromJson(Map<String, dynamic> object,
{CipherKey? cipherKey, Function? decryptFunction}) {
return BatchHistoryResultEntry._(
cipherKey == null
? object['message']
: decryptFunction!(cipherKey, object['message']),
Timetoken(BigInt.parse(object['timetoken'])),
object['uuid'], // <-- the problem here
MessageTypeExtension.fromInt(object['message_type']),
object['actions'],
object['meta'] == '' ? null : object['meta']);
}
}
object['uuid']
can be null but uuid
field cannot.
github-actions commented