toMap method

Map<String, Map?>? toMap()

Implementation

Map<String, Map?>? toMap() {
  final Map<String, String> login = {
    AiuiConstant.keyAppId: appId,
  };

  final Map<String, Map?> config = {
    AiuiConstant.keyLogin: login,
    AiuiConstant.keyUserParams: userParams,
    AiuiConstant.keyGlobal: global.toMap(),
    AiuiConstant.keyInteract: interact.toMap(),
    AiuiConstant.keyVad: vad.toMap(),
    AiuiConstant.keyIat: iat.toMap(),
    AiuiConstant.keyAudioParams: audioParams.toMap(),
    AiuiConstant.keyRecorder: recorder.toMap(),
    AiuiConstant.keyIvw: ivw.toMap(),
    AiuiConstant.keySpeech: speech.toMap(),
    AiuiConstant.keyTts: tts.toCfgMap(),
    AiuiConstant.keyLog: log.toMap(),
  };
  for (var conf in config.values) {
    conf?.removeWhere(_isNull);
  }
  config.removeWhere((key, value) => value == null || value.isEmpty);
  return config;
}