.dart

What is a .dart file?

Dart Source File · Code and data · Google · 2011

A .dart file is Dart source code, Google's language for building apps. It is the language of Flutter, the framework for making iOS, Android, web and desktop apps from a single codebase.

Category
Code and data
Type
Plain text
Is a .dart file safe to open? Caution. A .dart file is program source. Building and running it executes its code; review unfamiliar files first.

What is a .dart file used for?

Dart is a modern, typed language that compiles to native code for mobile and desktop, and to JavaScript for the web. Almost all Flutter apps are written entirely in .dart files.

The files are plain text and open in any editor; VS Code and Android Studio with the Dart and Flutter extensions are the common tools.

How to open a .dart file

The .dart format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .dart file.

Windows

  • VS Code
  • Android Studio
  • any text editor

macOS

  • VS Code
  • Android Studio
  • any text editor

Linux

  • VS Code
  • Android Studio
  • any text editor

.dart file signature (magic bytes)

Programs recognise a .dart file by the bytes at the start of the file, not by its name. These are the signatures for Dart.

Hex signatureOffsetNote
(no fixed signature)0plain text; no fixed magic bytes

See the full magic-numbers reference for every format.

Frequently asked questions

What is a .dart file?

A .dart file is Dart source code, Google's language for building apps. It is the language of Flutter, the framework for making iOS, Android, web and desktop apps from a single codebase.

How do I run a .dart file?

With Dart installed, run dart run file.dart. Flutter apps are run with flutter run from the project folder.

Is Dart only for Flutter?

No, but Flutter is its main use. Dart can also build command-line tools, servers and web apps that compile to JavaScript.

How do I open a .dart file?

Any text editor shows the source. VS Code or Android Studio with the Dart extension add full tooling.

Related formats

Sources

Details on this page were checked against authoritative references: