2
dart的命名参数与位置参数
source link: https://www.myfreax.com/dart-naming-parameters-and-location-parameters/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
更新于 2021/06/29 | 创建于 2021/06/29
dart的命名参数与位置参数
// postion params
void postionParams(bool b, String str) {
// ignore: avoid_print
print(b);
// ignore: avoid_print
print(str);
}
// name params
void nameParams({bool? b, String? str}) {
// ignore: avoid_print
print(b);
// ignore: avoid_print
print(str);
}
main(List<String> args) {
postionParams(true, 'str');
nameParams(b: true, str: 'string');
}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK