小编Abu*_*ama的帖子

Flutter go router 将 List 动态传递给参数

我正在使用 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”。

string router list flutter flutter-web

1
推荐指数
1
解决办法
1393
查看次数

无法应用Operator + =

我正在创建一个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)

我如何订阅活动?

c#

-3
推荐指数
1
解决办法
64
查看次数

标签 统计

c# ×1

flutter ×1

flutter-web ×1

list ×1

router ×1

string ×1