getMapFromPayload static method

Map<String, dynamic> getMapFromPayload(
  1. Object? payload
)

Implementation

static Map<String, dynamic> getMapFromPayload(Object? payload) {
  if (payload is String) {
    try {
      return json.decode(payload);
    } catch (e) {
      return {};
    }
  }
  if (payload is Map<String, dynamic>) return payload;
  return {};
}