How do you deal with indentation and structure in Flutter code?

avatar
155    1 year ago

How do you deal with indentation and structure in Flutter code?

Answers { 1 }
avatar
1 year ago

Android Studio provides tooling to make structuring Flutter code easier. The two main things are:

  1. Alt + Enter/ Command + Enter: This allows you to easily wrap and remove widgets as well as swap widgets in a complex hierarchy. To use this simply point your cursor at the widget declaration and press the keys to give you a few options. This legitimately feels like a godsend at times.
  2. DartFMT: dartfmt formats your code to maintain a clean hierarchy and indentation. It makes your code much prettier to work with after you accidentally move a few brackets around.