handleCommandMessage method

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

处理操作消息

Implementation

void handleCommandMessage(Map<String, dynamic> payload) {
  try {
    var commandMessage = CommandMessage.fromJson(payload);
    if (commandMessage.event == MessageEvent.command) {
      switch (commandMessage.command) {
        case CommandMessageCommands.restartApp:
          customSnackBar("操作", "重启APP");
          break;
        case CommandMessageCommands.restartSystem:
          customSnackBar("操作", "重启系统");
          break;
        case CommandMessageCommands.shutdownSystem:
          customSnackBar("操作", "关机");
          break;
      }
    }
  } catch (e, st) {
    log("[handleCommandMessage] 消息处理失败", error: e, stackTrace: st);
  }
}