handleStateMessage method

void handleStateMessage(
  1. Map<String, dynamic> payload
)

处理状态消息

Implementation

void handleStateMessage(Map<String, dynamic> payload) {
  try {
    var message = StateMessage.fromJson(payload);
    if (message.state == StateMessageStates.sync) {
      stateMessage.value = message;
      stateMessage.value.state = StateMessageState.online;
      stateMessage.refresh();
      localStg.write(StorageKey.stateMessage, stateMessage.value.toJson());
      log('[handleStateMessage] 同步状态消息成功');
    }
  } catch (e, st) {
    log("[handleStateMessage] 消息处理失败", error: e, stackTrace: st);
  }
}