Dart Formatter
Format and validate Dart/Flutter code online for free, right in your browser.
Local browser processing
No sign-up required
Powered by official dart format
LanguageFor Dart / Flutter code
Dartmain.dart
Line width
InputEditable
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
OutputDart valid44 lines · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() { _counter++; });
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(backgroundColor: Theme.of(context).colorScheme.inversePrimary, title: Text(widget.title)),
body: Center(child: Column(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
const Text('You have pushed the button this many times:'),
Text('$_counter', style: Theme.of(context).textTheme.headlineMedium),
])),
floatingActionButton: FloatingActionButton(onPressed: _incrementCounter, tooltip: 'Increment', child: const Icon(Icons.add)),
);
}
}
UTF-8 · 2 spaces · Line width 80 · dart formatLocal processing · Ready
How It WorksDart
Overview
This Dart formatter cleans up code with inconsistent indentation or mixed styles into a standard format, powered by a WebAssembly build of the official Dart formatting tool. The output is identical to running dart format locally. Everything runs locally in your browser; your code never leaves your device.
Use Cases
Format Dart/Flutter code pasted from docs or generated by AIUnify a team's Flutter code styleClean up legacy code with inconsistent indentationValidate whether Dart code syntax is correct
Steps
123
Paste or uploadSet line widthGet the result