Means to optionally include a named argument #53764
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
closed-duplicate
Closed in favor of an existing report
If a function makes a named parameter optional by specifying a default value, rather than by making it nullable, then there is no inline syntactical way of conditionally providing an argument to the parameter:
Both default values and a nullable type allow a named parameter not to be specified (
(1)
and(2)
).However, while you can conditionally provide an arg to a named parameter if it is nullable (
(3)
), you can't do it if a parameter is not nullable, even if it has a default value -- you have to use anif
-statement ((4)
).It would be great if
if
-statements could be used to optionally provide named arguments ((5)
). This is analogous to howif
-statements can be used to optionally include elements in list literals.The text was updated successfully, but these errors were encountered: