initWithParamInfo method
void
initWithParamInfo(
- AIParamInfo info, {
- SVUIInitListener? listener,
- bool? isTest,
- IPlayer? player,
初始化方法 @param info 账户信息 @param listener 初始化结果监听(可选参数) @param isTest true:测试环境 false:线上环境 默认线上(可选参数) @param player 音频播放器 TTS时使用(可选参数)
Implementation
void initWithParamInfo(AIParamInfo info,
{SVUIInitListener? listener, bool? isTest, IPlayer? player}) async {
if (null != player) {
setTTSPlayer(player);
}
try {
String infoJson = json.encode(info);
bool res = await Configure.channel.invokeMethod("initSVUI",
{'paramInfo': infoJson, 'isTest': null == isTest ? false : isTest});
if (res) {
if (null != listener && null != listener.onCompleted) {
listener.onCompleted!();
}
}
} on PlatformException catch (e) {
// result.error("failed", "failed unknow", "i don't know")
print(e);
if (null != listener && null != listener.onFailed) {
listener.onFailed!(int.parse(e.code), e.message);
}
} on MissingPluginException catch (e) {
//result.notImplemented()
print(e);
if (null != listener && null != listener.onFailed) {
listener.onFailed!(ErrorCode.NOT_IMPLEMENTED, e.message);
}
}
}