[Event] Better nullcheck

This commit is contained in:
Christian Pauly 2019-08-29 08:56:10 +02:00
parent 3bfed389a2
commit 7edffb1219

View file

@ -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;
}