What does the empty parentheses after the onPressed property mean in Dart?

前端 未结 5 1372
情歌与酒
情歌与酒 2020-12-03 15:11

I know the syntax for calling a function after onPressed and onTap for a widget. There are two options We can use either the () => functio

5条回答
  •  -上瘾入骨i
    2020-12-03 15:44

    I've learned to treat the empty parentheses as a build first then with the returned value execute this function.

    I ran into an issue using the second method you posted where flutter would crash stating "cannot build because the framework is already building" and found this post on StackOverflow which may give you a better idea of what it means. Flutter - Cannot build because the frawework is already building

提交回复
热议问题