talira

dart_style

An opinionated, automatic Dart source code formatter

open sourceBSD-3-Clausefree

dart_style is the formatter behind dart format in the Dart SDK: it replaces the whitespace in Dart code with the layout it judges best, handling indentation, inline whitespace and line wrapping, and makes small changes to non-semantic punctuation such as trailing commas. It is minimally configurable, follows the Dart style guide and never breaks code, so it can run from build and presubmit scripts, and the package also exposes a library API for formatting code from Dart programs.

Problems it solves

  • format Dart code automatically in a consistent style
  • fail CI when Dart code isn't formatted
  • format Dart source from inside a Dart program

Features

  • dart format in the Dart SDK
  • intelligent line wrapping
  • check mode that sets the exit code for CI
  • library API for formatting code

Alternatives

The same job

These do what dart_style does.

  1. rustfmt A tool for formatting Rust code according to style guidelines

Compare dart_style with the top 3