我正在使用 go router 作为 flutter 应用程序,我可以在活动之间传递字符串参数,现在它正在工作,我想传递动态列表,但出现错误
参数类型“String”无法分配给参数类型“List”。(文档)
接收器活动有
class EditUserPage extends StatefulWidget {
final String name;
final List<dynamic> userinformation;
}
Run Code Online (Sandbox Code Playgroud)
在路线构建器上,我已经传递了如下数据
GoRoute(
path: 'editusers',
name:
'editusers/:name,:userinformation,'
builder: (BuildContext context, GoRouterState state) {
return EditUserPage(
state.params["name"]!,
state.params["userinformation"]!,
)
);
Run Code Online (Sandbox Code Playgroud)
错误出现在这一行 state.params["userinformation"]!, 参数类型“String”无法分配给参数类型“List”。
我正在创建一个C#WinForms应用程序,应该使用语音命令"exit"关闭应用程序.
但它给了我一个例外:
运算符+ =无法应用于系统语音或主方法的操作数
在这段代码中:
public partial class Form1 : Form
{
SpeechRecognitionEngine sRecongize = new SpeechRecognitionEngine();
private void Form1_Load(object sender, EventArgs e)
{
// Compiler error here:
sRecongize += sRecongize_SpeechRecognized;
}
private void sRecongize_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
if (e.Result.Text == "exit")
{
Application.Exit();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我如何订阅活动?