Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why does formatting code in VS Code always return uglier code than I expected?

I’m formatting code in VS Code. However, VS Code always returns uglier code than I expected.

Example:

My original code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

                                                    body: Padding(
                                                      padding: const EdgeInsets.all(AppSizes.kDefaultPadding,),
                                                      …
                                                    ),

Expected code:

                                                    body: Padding(
                                                      padding: const EdgeInsets.all(
                                                        AppSizes.kDefaultPadding,
                                                      ),
                                                      …
                                                    ),

Actual code:

                                                    body: Padding(
                                                      padding:
                                                          const EdgeInsets.all(
                                                        AppSizes
                                                            .kDefaultPadding,
                                                      ),
                                                      …
                                                    ),

The actual code is really ugly (in my opinion, not sure how others see it).

How can I get the expected code? I would appreciate any help. Thank you in advance!

>Solution :

As jamesdlin commented, Open your setting and search for dart line length, increase the value

enter image description here

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading