[Event] Better nullcheck
This commit is contained in:
parent
3bfed389a2
commit
7edffb1219
|
@ -67,7 +67,8 @@ class RawEvent {
|
|||
|
||||
static Map<String, dynamic> getMapFromPayload(dynamic payload) {
|
||||
print("getMapFromPayload: $payload");
|
||||
if (payload is String && !payload.isEmpty) return json.decode(payload);
|
||||
if (payload == null || (payload is String && payload.isEmpty)) return null;
|
||||
if (payload is String) return json.decode(payload);
|
||||
if (payload is Map<String, dynamic>) return payload;
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue