Skip to content

Commit

Permalink
fix: message extras decoding
Browse files Browse the repository at this point in the history
By default `JsonObject` is deserializing into `Map<Object?, Object?>`, we need to do explicit cast to get `Map<String, dynamic>`
  • Loading branch information
ttypic committed May 21, 2024
1 parent 4e2dd3b commit 389acd0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/src/message/src/message_extras.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ class MessageExtras with ObjectHash {
// for example, when it's a CastMap, so we need to create a mutable
// instance from the existing extras map
final mutableExtrasMap = Map<String, dynamic>.from(extrasMap);
final deltaMap =
mutableExtrasMap.remove(TxMessageExtras.delta) as Map<String, dynamic>?;
final deltaMap = mutableExtrasMap.remove(TxMessageExtras.delta) as Map?;
final deltaExtras = (deltaMap == null)
? null
: DeltaExtras.fromMap(Map<String, dynamic>.from(deltaMap));

return MessageExtras._withDelta(
mutableExtrasMap,
(deltaMap == null) ? null : DeltaExtras.fromMap(deltaMap),
deltaExtras,
);
}

Expand Down

0 comments on commit 389acd0

Please sign in to comment.