Last active
September 12, 2024 15:43
-
-
Save evaisse/db16699b0d5d3093f07a9dfc3247ef70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cool { | |
final int count; | |
Cool({ int? count = 20 }): this.count = count ?? 20; | |
} | |
class NotCool { | |
final int count; | |
NotCool({ this.count = 20 }); | |
} | |
void main() { | |
int? myArg = null; | |
Cool( | |
count: myArg | |
); | |
NotCool( | |
// invoke without having to know the default value is impossible... | |
count: myArg ?? 20 | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment