Skip to content
pubscout

dart_style

3.1.14, released 5 weeks ago by tools.dart.dev

Provides an API and CLI to format Dart source code automatically.

Rock solid
$ flutter pub add dart_style
Source repository

What it does

Rewrites Dart code to follow the official Dart style guide, handling indentation, line wrapping, and punctuation. It can be used as a library or via the `dart format` command.

AI-written summary of version 3.1.14, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Enforcing consistent code style in a project
  • Running formatting in CI or pre‑commit hooks

Skip it when

  • Needing runtime code transformation
  • When you require linting beyond formatting

Strengths

  • Official package from the Dart team
  • Works with the Dart SDK `dart format` command
  • Configurable via analysis options

Weaknesses

  • Only formats code, no linting or analysis
  • Limited configuration options

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
8
import 'package:dart_style/dart_style.dart';

void main() {
  final formatter = DartFormatter();
  print(formatter.format('class A{void m(){}}'));
}

Alternatives

Packages that do the same job and could replace dart_style.

  • hotreloader

    Automatic hot code reloader for Dart projects that applies file changes to the running process.

  • cli_tools

    Utilities for building command‑line interfaces, including argument parsing, analytics, and progress reporting.

  • flutter_patcher

    Self-hosted OTA hotfix tool for Flutter with signed code and asset patches.

  • dart_format

    Configurable Dart/Flutter formatter that never wraps lines unless requested

Works with

Packages commonly used together with dart_style: ones it builds on, ones built on it, and its own family.