我正在尝试从我的聊天机器人生成响应(使用dialogflow)
void response(query) async {
AuthGoogle authGoogle = await AuthGoogle(
fileJson: "Assets/amigo-pyhyyy-e2d1db5e1ee9.json").build();
Dialogflow dialogflow = await Dialogflow(
authGoogle: authGoogle, language: Language.english);
AIResponse aiResponse = await dialogflow.detectIntent(query);
setState(() {
messages.insert(0, {"data": 0,
"message": aiResponse.getListMessage()[0]["text"]["text"][0].tostring()
});
});
我收到此错误:E / flutter(8166):[ERROR:flutter / lib / ui / ui_dart_state.cc(157)]未处理的异常:NoSuchMethodError:类'String'没有实例方法'tostring'。
我尝试在pubspec.yaml中添加依赖项:依赖关系:to_string:^ 1.2.1dev_dependencies:to_string_generator:^ 1.2.1
但是我没有在应用程序上从机器人那里得到答复,而是在控制台上得到了答复。