当前位置:网站首页>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
边栏推荐
- 带wiringPi库在unbutu 编译 并且在树莓派运行
- 一个service层需要调用另两个service层获取数据,并组装成最后的数据,数据都是list,缓存如何设计?
- /usr/sbin/vmware-authdlauncher: error while loading shared libraries: libssl.so.1.0.2*Solution
- ROS2 series of knowledge (4): understand the concept of [service]
- 剑指offer专项突击版第16天
- 指定set 'execution.savepoint.path'后,重启flinksql报这个错是啥
- HCIP(15)
- 【消息通知】用公众号模板消息怎么样?
- [uniCloud] Application and Improvement of Cloud Objects
- Handwritten binary search tree and test
猜你喜欢
ARM 交叉编译
Summary of JVM interview questions (continuously updated)
【搜索专题】看完必会的BFS解决最短路问题攻略
剑指offer专项突击版第16天
开源项目站点必备&交流区功能
对无限debugger的一种处理方式
解决IDEA默认情况下新建文件时,右击,new,没有XML文件的问题
Daily practice of LeetCode - Circular linked list question (interview four consecutive questions)
leetcode6133. 分组的最大数量(中等)
Game Security 03: A Simple Explanation of Buffer Overflow Attacks
随机推荐
软考高级系统架构设计师系列之:系统开发基础知识
Data Middle Office Construction (VII): Data Asset Management
WebApi hits an Attribute to handle exceptions uniformly
[Data analysis] Based on matlab GUI student achievement management system [including Matlab source code 1981]
The fledgling Xiao Li's 113th blog project notes: Wisdom cloud smart flower watering device combat (2) - basic Demo implementation
ARM 交叉编译
从设备树(dtb格式数据)中解析出bootargs
sqlserver cannot connect remotely
IDEA does not recognize the module (there is no blue square in the lower right corner of the module)
Beijing suddenly announced that yuan universe big news
Google Earth Engine - Error resolution of Error: Image.clipToBoundsAndScale, argument 'input': Invalid type
What practical projects can machine learning beginners learn?
RTL8762DK RTC (5)
button去除黑框
被 CSDN,伤透了心
Euler system (euleros): upgrade Mysql
RTL8762DK uses DebugAnalyzer (four)
【SemiDrive源码分析】系列文章链接汇总(全)
每周小结(*67):为什么不敢发表观点
【Make YOLO Great Again】YOLOv1-v7全系列大解析(Neck篇)