Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (31 sloc) 1.43 KB
title description toc
Formatting code
Use dartfmt to format your code, and follow Effective Dart guidelines for what dartfmt doesn't cover.
false

As Effective Dart says, when it comes to things like formatting, arguments about which is better are subjective and impossible to resolve. What we do know is that being consistent is objectively helpful. If two pieces of code look different it should be because they are different in some meaningful way. When a bit of code stands out and catches your eye, it should do so for a useful reason.

Fortunately, you can use the dartfmt tool — from the command line or in your favorite Dart-savvy IDE — to perform most of the drudge work of formatting your code. For example, here's how to format all the Dart files under the current directory's bin, lib, and test directories:

$ dartfmt -w bin lib test

However, dartfmt can't do it all. To avoid making changes that might be unsafe, dartfmt affects only whitespace. For additional guidance, see the Effective Dart style guidelines, especially the formatting guidelines.

More information:

You can’t perform that action at this time.