Created
March 17, 2022 00:34
-
-
Save mono0926/8d29b35ca9bc0ec984ee6fb9a22baa37 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
const condition = false; | |
void main() { | |
// {} 省略はミスの元なので一般的に良くないと言われているけどdart format前提ならミスしなさそうで、ありな気もする🤔 | |
// https://dart-lang.github.io/linter/lints/always_put_control_body_on_new_line.html | |
if (condition) throw Exception('hello'); | |
// `throw`の前で改行してFix Allすると自動的に {} 付けてくれて便利 | |
if (condition) { | |
throw Exception('hello'); | |
} | |
final list = [ | |
1, | |
2, | |
// ちょっと違うけど、Dart 2.3 での collection if も似てる | |
// https://dart.dev/guides/language/language-tour#collection-operators | |
// https://medium.com/dartlang/announcing-dart-2-3-optimized-for-building-user-interfaces-e84919ca1dff | |
if (condition) 3, | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment