当前位置:网站首页>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
边栏推荐
- 纽约大学等 | TM-Vec:用于快速同源检测和比对的模版建模向量
- Chain programming, packages, access
- date command
- Introduction to machine learning how to?
- second uncle
- 情人节浪漫3D照片墙【附源码】
- pdb drug comprehensive database
- MySQL modifies SQL statements to optimize performance
- ROS2 series of knowledge (4): understand the concept of [service]
- IDEA modifies the annotation font
猜你喜欢
简单易用的任务队列-beanstalkd
【搜索专题】看完必会的BFS解决最短路问题攻略
[Data analysis] Based on matlab GUI student achievement management system [including Matlab source code 1981]
Replacing the Raspberry Pi Kernel
Which interpolation is better for opencv to zoom in and out??
You need to know the TCP wave four times
Completely closed Chrome updated and in the top right corner of the tip
开源项目站点必备&交流区功能
Flutter “Hello world“ 程代码
被 CSDN,伤透了心
随机推荐
Parse the bootargs from the device tree (dtb format data)
IDEA debugging
2. # 代码注释
每周小结(*67):为什么不敢发表观点
Soft Exam Senior System Architect Series: Basic Knowledge of Information Systems
MYSQL-Batch insert data
This map drawing tool is amazing, I recommend it~~
RTL8762DK UART (two)
The fledgling Xiao Li's 113th blog project notes: Wisdom cloud smart flower watering device combat (2) - basic Demo implementation
从设备树(dtb格式数据)中解析出bootargs
button去除黑框
New York University et al | TM-Vec: Template Modeling Vectors for Rapid Homology Detection and Alignment
HIRO: Hierarchical Reinforcement Learning 】 【 Data - Efficient Hierarchical Reinforcement Learning
剑指offer专项突击版第16天
IDEA无法识别module(module右下角没有蓝色小方块)
RTL8762DK RTC (5)
Talking about hardware device computing storage and data interaction
MySQL修改SQL语句优化性能
IDEA modifies the annotation font
High dimensional Gaussian distribution basics