fix: use TryGet.optional
This commit is contained in:
parent
6d6830505f
commit
46b2f8898e
|
|
@ -264,7 +264,8 @@ class OlmManager {
|
|||
// and generate and upload more if not.
|
||||
|
||||
// If the server did not send us a count, assume it is 0
|
||||
final keyCount = countJson?.tryGet<int>('signed_curve25519') ?? 0;
|
||||
final keyCount =
|
||||
countJson?.tryGet<int>('signed_curve25519', TryGet.optional) ?? 0;
|
||||
|
||||
// If the server does not support fallback keys, it will not tell us about them.
|
||||
// If the server supports them but has no key, upload a new one.
|
||||
|
|
|
|||
|
|
@ -778,11 +778,12 @@ class FamedlySdkHiveDatabase extends DatabaseApi {
|
|||
: null;
|
||||
|
||||
// calculate the status
|
||||
final newStatus = eventUpdate.content.tryGet<int>('status') ??
|
||||
eventUpdate.content
|
||||
.tryGetMap<String, dynamic>('unsigned')
|
||||
?.tryGet<int>(messageSendingStatusKey) ??
|
||||
2;
|
||||
final newStatus =
|
||||
eventUpdate.content.tryGet<int>('status', TryGet.optional) ??
|
||||
eventUpdate.content
|
||||
.tryGetMap<String, dynamic>('unsigned', TryGet.optional)
|
||||
?.tryGet<int>(messageSendingStatusKey, TryGet.optional) ??
|
||||
2;
|
||||
|
||||
final status = newStatus == -1 || prevEvent?.status == null
|
||||
? newStatus
|
||||
|
|
@ -796,8 +797,8 @@ class FamedlySdkHiveDatabase extends DatabaseApi {
|
|||
|
||||
// In case this event has sent from this account we have a transaction ID
|
||||
final transactionId = eventUpdate.content
|
||||
.tryGetMap<String, dynamic>('unsigned')
|
||||
?.tryGet<String>('transaction_id');
|
||||
.tryGetMap<String, dynamic>('unsigned', TryGet.optional)
|
||||
?.tryGet<String>('transaction_id', TryGet.optional);
|
||||
|
||||
await _eventsBox.put(MultiKey(eventUpdate.roomID, eventId).toString(),
|
||||
eventUpdate.content);
|
||||
|
|
|
|||
Loading…
Reference in New Issue