Ternary operators not being formatted like they are in the widgets in VS Code
See original GitHub issueSteps to Reproduce
I have a getter in my model, in model.dart that (intelliJ I guess) formats like this: instead of like this:
Expected results: IntelliJ formats nested ternary operators well in my widgets. Like this example in my main_screen.dart
Actual results:
Logs
[✓] Flutter (Channel master, 1.19.0-0.0.pre, on Mac OS X 10.15.4 19E287, locale es-ES)
• Flutter version 1.19.0-0.0.pre at /Users/tomas/Developer/flutter
• Framework revision 053c38818f (4 days ago), 2020-05-07 15:22:03 -0700
• Engine revision 3953c3ccd1
• Dart version 2.9.0 (build 2.9.0-5.0.dev 4da5b40fb6)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/tomas/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.9.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] VS Code (version 1.44.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.10.1
[✓] Connected device (3 available)
• iPhone 11 Pro • A85E0A78-987E-41EA-9676-E33AC01D746D • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)
• Web Server • web-server • web-javascript • Flutter Tools
• Chrome • chrome • web-javascript • Google Chrome 81.0.4044.138
• No issues found!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
I am getting an error while writing a ternary operator under a ...
I am getting this error The element type 'Set' can't be assigned to the list type 'Widget' How do I fix this? flutter...
Read more >Ternary format bug - Visual Studio Feedback
When writing the code std::string {} + (true ? "yes" : "no"); , and selecting the line before pressing Ctrl+K, Ctrl+F (Edit.FormatSelection), VS...
Read more >Flutter Tutorial for Beginners #33 -Ternary Operators - YouTube
Hey gang, in this Flutter tutorial we'll see how to use a ternary operator in Dart to choose what background image to show...
Read more >Curious Perversions in Information Technology - The Daily WTF
Yup, the real problem here was common subexpressions, not the ternary operator. I consider duplicated code to be the worst enemy of clarity....
Read more >Ternary Operator in Python - GeeksforGeeks
Ternary operators are also known as conditional expressions are operators that evaluate something based on a condition being true or false.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh sorry, I see what you mean. Based on the text in the FAQ it may be worth filing an issue at dart_style for their take on it, it may be considered a reasonable change.
I just reported it there: https://github.com/dart-lang/dart_style/issues/927
Thanks!