parse static method

IosZjEvent parse(
  1. dynamic message
)

解析事件

Implementation

static IosZjEvent parse(dynamic message) {
  IosZjEventType type = IosZjEventType.unknown;
  IosZjEventAction action = IosZjEventAction.unknown;
  int code = 0;
  String? msg;
  String? extra;
  int id = 0;

  Map<String, dynamic>? ret = (message as Map<String, dynamic>?);
  if (ret != null) {
    // type = (ret["type"] as int).toEventType;
    type = IosZjEventType.parse(ret["type"] as int);
    id = ret["viewId"] ?? 0;
    // action = (ret["action"] as String).toEventAction;
    action = IosZjEventAction.parse((ret["action"] as String));
    code = ret["code"] ?? 0;
    msg = ret["msg"];
    extra = ret["extra"];
  }
  return IosZjEvent(type, action,
      code: code, msg: msg, extra: extra, viewId: id);
}