当前位置:网站首页>Dart named parameter syntax
Dart named parameter syntax
2022-08-01 03:04:00 【Little cock kawaii~】
For the following code:
void debugger(String message, int lineNum) {// ...}
Two parameters must be provided when calling:
debugger('A bug!', 55)span>;
If the parameter is changed to a named parameter, the parameter becomes optional:
void debugger({String message, int lineNum}) {// ...}
Call:
debugger(message: 'A bug!', lineNum: 44);
Class constructor parameters can also use this syntax.
If a function has a lot of parameters, say 10, using the positional parameter syntax, it is very troublesome to have to remember which parameters are in what positions, but since named parameters use names, the order of the parameters' position becomes irrelevant, soavoids this problem.
https://flutterbyexample.com/lesson/function-arguments-default-optional-named
边栏推荐
- The fledgling Xiao Li's 114th blog project notes: Wisdom cloud intelligent flower watering device combat (3) - basic Demo implementation
- RTL8762DK uses DebugAnalyzer (four)
- 剑指offer专项突击版第16天
- Parse the bootargs from the device tree (dtb format data)
- 一个service层需要调用另两个service层获取数据,并组装成最后的数据,数据都是list,缓存如何设计?
- MySQL修改SQL语句优化性能
- Dart 命名参数语法
- how to edit the table of contents of an epub ebook
- After specifying set 'execution.savepoint.path', restart flinksql and report this error
- HCIP(15)
猜你喜欢
随机推荐
The kernel of the decompression process steps
【分层强化学习】HIRO:Data-Efficient Hierarchical Reinforcement Learning
Flink deploys and submits jobs
初出茅庐的小李第112篇博客项目笔记之机智云智能浇花器实战(1)-基础Demo实现
MYSQL logical architecture
After specifying set 'execution.savepoint.path', restart flinksql and report this error
Talking about hardware device computing storage and data interaction
787. 归并排序
<JDBC> 批量插入 的四种实现方式:你真的get到了吗?
软件测试面试(三)
初出茅庐的小李第113篇博客项目笔记之机智云智能浇花器实战(2)-基础Demo实现
"Youth Pie 2": The new boyfriend stepped on two boats, and the relationship between Lin Miaomiao and Qian Sanyi warmed up
Flutter “Hello world“ 程代码
Parse the bootargs from the device tree (dtb format data)
HIRO: Hierarchical Reinforcement Learning 】 【 Data - Efficient Hierarchical Reinforcement Learning
lua entry case combat 123DIY
Completely closed Chrome updated and in the top right corner of the tip
785. Quick Sort
在打开MYSQL表时,有的可以显示编辑,有的没有,如何设置。
从设备树(dtb格式数据)中解析出bootargs