Pass a function with parameters to a VoidCallback

后端 未结 7 1739
情书的邮戳
情书的邮戳 2021-01-30 10:22

Is it possible to pass a Function with parameters to a VoidCallback?

for example something like this:

class MyClass {
  void doSomething(int i){

  }

           


        
7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 11:10

    Flutter already has a typedef for this: ValueSetter.

    So you can pass an instance of ValueSetter to your other class.

提交回复
热议问题