当前位置:网站首页>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
边栏推荐
- By Value or By Reference
- ROS2 series of knowledge (4): understand the concept of [service]
- The fledgling Xiao Li's 114th blog project notes: Wisdom cloud intelligent flower watering device combat (3) - basic Demo implementation
- RTL8762DK RTC (5)
- [cellular automata] based on matlab interface aggregation cellular automata simulation [including Matlab source code 2004]
- 这个地图绘制工具太赞了,推荐~~
- 设备树的树形结构到底是怎样体现的?
- 初出茅庐的小李第113篇博客项目笔记之机智云智能浇花器实战(2)-基础Demo实现
- IDEA无法识别module(module右下角没有蓝色小方块)
- Unity在BuildIn渲染管线下实现PlanarReflection的初级方法
猜你喜欢
随机推荐
Nmap manuals - the full version
HCIP(15)
Fat interface in JQESAP system
Chain programming, packages, access
带wiringPi库在unbutu 编译 并且在树莓派运行
Modify Postman installation path
初出茅庐的小李第112篇博客项目笔记之机智云智能浇花器实战(1)-基础Demo实现
By Value or By Reference
数据中台建设(七):数据资产管理
简单易用的任务队列-beanstalkd
软件测试面试(三)
The device node structure is converted into a platform_device structure
Completely closed Chrome updated and in the top right corner of the tip
带你体验一次类型编程实践
MySQL modifies SQL statements to optimize performance
Soft Exam Senior System Architect Series: Basic Knowledge of Information Systems
By CSDN, torn
New York University et al | TM-Vec: Template Modeling Vectors for Rapid Homology Detection and Alignment
This map drawing tool is amazing, I recommend it~~
IDEA modifies the annotation font