String sayHello(String name, int age, [String? country = 'cuba']) => 'Hello $name, you are $age years old from $country';
void main(){
sayHello('nico',12);
}
country is not required, and default value is set.
Nico doesn't use this a lot! like less than ten times.
Nico uses 'named' parameters a lot !!
출처: https://nomadcoders.co/dart-for-beginners/lectures/4111
All Courses – 노마드 코더 Nomad Coders
초급부터 고급까지! 니꼬쌤과 함께 풀스택으로 성장하세요!
nomadcoders.co
'스터디 > Dart' 카테고리의 다른 글
[Dart] #3.5 Typedef (0) | 2024.01.10 |
---|---|
[Dart] #3.4 QQ Operator ?? and ??= (0) | 2024.01.10 |
[Dart] #3.2 Recap ^_^ (positional,named,required,default) (0) | 2024.01.10 |
[Dart] #3.1 Named Parameters ({ }) (0) | 2024.01.10 |
[Dart] #3.0 Functions (0) | 2024.01.10 |