.dart File Extension

Learn what a .dart file contains, how to open and run Dart source code, how Poly supports it, and how it differs from generated output.

File extension details for .dart

Full Support
File typeDart source code
MIME type
EncodingUnicode plain text, normally UTF-8
Operating systemsWindows, macOS, Linux
Opens withVisual Studio Code, Android Studio, IntelliJ IDEA, DartPad
Poly supportYes. Poly recognizes .dart as readable Dart source code.
Indexed by PolyYes. Poly indexes readable source for exact and semantic search.
Preview in PolyYes. Dart source opens in Poly's code editor with syntax highlighting.
Poly agentYes. The Poly agent can read and reason about the source text.

What kind of file is a .dart?

A .dart file contains source code written in the Dart programming language. It is human-readable text, not a compiled application. A file can be a library, part of a library, test, command-line entrypoint, or Flutter application source. Dart's glossary defines a library as one primary .dart file plus any optional part files.1

Dart source has no fixed magic bytes. Software usually recognizes it from the suffix, a supplied media type, or syntax such as import, class, and void main(). IANA registers application/vnd.dart, while Poly classifies the suffix as readable text/plain for its text features.2 UTF-8 is the safest encoding for sharing source across tools and systems.

Renaming a text file to .dart does not validate or translate its contents. Renaming compiled JavaScript or a native executable to .dart does not recover the original source.

How do I open a .dart on my computer?

Any text editor can open .dart. Visual Studio Code, Android Studio, and IntelliJ IDEA have Dart tooling for highlighting, completion, navigation, formatting, analysis, and debugging. DartPad provides a browser-based place to try Dart without installing an SDK.3

Install the Dart SDK to work with a non-Flutter project. The Flutter SDK already includes the full Dart SDK. In a configured project, you can analyze and run a suitable entrypoint with:

dart analyze
dart run bin/my_app.dart

The dart command can also format, test, document, and compile code.3 Opening a source file for reading is safe, but running it can execute arbitrary code and access resources allowed to the process. Review unfamiliar projects and their dependencies before execution.

Poly support for .dart

Poly opens .dart files in a read-only, code-friendly viewer with Dart syntax highlighting, word wrap, and in-file search. It indexes readable source for exact and semantic search, so you can find a declaration by name or locate code by its purpose. The Poly agent can read the text to summarize a class, explain a function, or help trace likely behavior.

Poly does not execute the program, fetch packages, run code generation, or reproduce analyzer and compiler state. Keep related source, tests, documentation, and pubspec.yaml together when wider project context matters.

History of .dart

Dart was first released in 2011 as an embeddable, multi-platform language. Its early implementations ran on a standalone virtual machine, in a browser, or by compiling to JavaScript.4 The .dart suffix became the standard convention for its source files.

Ecma published the first ECMA-408 Dart language specification in June 2014.5 Flutter later made Dart especially common for mobile, desktop, and web user interfaces. The suffix does not identify a language version or target platform, so check the project's SDK constraint and package configuration before building older code.

Working with .dart and alternatives

The surrounding filename and directory communicate a file's role:

FileTypical role
.dartEditable Dart library, entrypoint, test, or tool source
pubspec.yamlPackage metadata, SDK constraints, and dependencies
.g.dartConventionally generated Dart source
.jsJavaScript output from a web compilation
Native executableCompiled machine code for a target platform

Dart's package layout places reusable public libraries under lib, implementation details under lib/src, command-line entrypoints under bin, and tests under test.6 Generated .g.dart files are still Dart source, but edit the generator input when project instructions say they will be overwritten.

Keep source and package metadata in version control. Compiling Dart to JavaScript or native code creates a build artifact. Translating Dart to another programming language requires conversion and testing, not a filename change.

Footnotes

  1. Dart. Glossary: Library and Entrypoint.
  2. Internet Assigned Numbers Authority. Media Types Registry. The application registry includes application/vnd.dart.
  3. Dart. Tools. Documents supported editors, DartPad, SDK availability, and the dart command. 2
  4. Dart. History of JS Interop in Dart. Describes Dart's 2011 release and its original deployment models.
  5. Ecma International. ECMA-408: Dart Programming Language Specification. The archive lists the first edition from June 2014.
  6. Dart. Package Layout Conventions.
© Poly Corp. 2026