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.
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.
What opens 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.
Windows
- VS Code
- Android Studio
- any text editor
macOS
- VS Code
- Android Studio
- any text editor
Linux
- VS Code
- Android Studio
- any text editor
Open a .dart file step by step
- Confirm the file really is a .dart. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
- On Windows, open it with VS Code or Android Studio.
- On Mac, use VS Code or Android Studio.
- On Linux, try VS Code or Android Studio.
- Still stuck? Search for a dedicated Dart viewer rather than a generic one.
Why can't I open my .dart file?
Almost always because no installed app understands Dart. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.
The other possibility is that the file is not really a .dart at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.
Dart has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.
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. How sources are ranked and what is deliberately left out is set out in the methodology.