In this guide, we will discuss the Optional positional parameter in Dart Programming Language. To specify optional positional parameters, use square [] brackets.
Syntax
void function_name(param1, [optional_param_1, optional_param_2]) { }
If an optional parameter is not passed a value, it is set to NULL.
Example
void main() { test_param(123); } test_param(n1,[s1]) { print(n1); print(s1); }
It should produce the following output−
123 null
Next Topic : Click Here
Pingback: Dart Programming - Parameterized Function | Adglob Infosystem Pvt Ltd
Pingback: Dart Programming - Functions | Adglob Infosystem Pvt Ltd