[Event] Fix getMapFromPayload
This commit is contained in:
parent
c33350f796
commit
e54f134d92
|
@ -65,10 +65,11 @@ class RawEvent {
|
||||||
this.unsigned,
|
this.unsigned,
|
||||||
this.room});
|
this.room});
|
||||||
|
|
||||||
static Map<String, dynamic> getMapFromPayload(dynamic payload) =>
|
static Map<String, dynamic> getMapFromPayload(dynamic payload) {
|
||||||
payload is String
|
if (payload is String) return json.decode(payload);
|
||||||
? json.decode(payload)
|
if (payload is Map<String, dynamic>) return payload;
|
||||||
: payload is Map<String, dynamic> ? payload : null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// Get a State event from a table row or from the event stream.
|
/// Get a State event from a table row or from the event stream.
|
||||||
factory RawEvent.fromJson(Map<String, dynamic> jsonPayload, Room room) {
|
factory RawEvent.fromJson(Map<String, dynamic> jsonPayload, Room room) {
|
||||||
|
|
Loading…
Reference in a new issue