Released · improving
Programming language · Since 2011
Dart is a client-optimized language from Google that powers Flutter apps and also runs on servers, in command-line tools and on the web.
Dart is an open-source programming language developed by Google and first unveiled in 2011. It pairs a familiar C-style syntax with class-based object orientation, and its statically typed system with type inference and sound null safety catches null-related errors at compile time.
Today Dart is best known as the language of Flutter, which builds Android, iOS, web and desktop apps from a single codebase. During development, JIT compilation enables hot reload; for release, AOT compilation produces fast native machine code. Outside Flutter, Dart compiles command-line tools and server programs to standalone executables, and it can compile to JavaScript or WebAssembly to run on the web.
To get started, install the Dart SDK from dart.dev; if you have already installed the Flutter SDK, Dart is included. To try it without installing anything, use DartPad in your browser, learn the basics from the language introduction, read Effective Dart for idiomatic style, and browse pub.dev for packages.
Types are non-nullable by default, so the compiler catches null-reference errors before the program runs, while type inference keeps code concise.
JIT compilation powers hot reload during development, and AOT compilation produces fast-starting native executables for release.
The same Dart code compiles to machine code for mobile and desktop, and to JavaScript or WebAssembly for the web.
async/await, Futures and Streams keep asynchronous code readable, and isolates run work in parallel without sharing memory.
Follow the instructions on dart.dev to install the Dart SDK for Windows, macOS or Linux. Package managers such as Chocolatey, Homebrew or apt work too, and the Flutter SDK already includes the Dart SDK.
Open a new terminal and check that the dart command is on your PATH and reports its version.
dart --versionGenerate a new project from the command-line app template. It contains pubspec.yaml, which describes the package, and the entry point bin/hello.dart.
dart create helloEvery Dart program starts at the top-level main function. print lives in the dart:core library, so no import is needed, and dart run compiles the file and runs it immediately.
bin/hello.dart
void main() {
print('Hello, world!');
}
dart run bin/hello.dartSix chapters that take you from installation to the core ideas of Dart.
Ask questions, share experience and trade opinions about Dart.
No discussions yet. Start the first one.
0 comments
Sign in · Sign in to leave a comment.
Be the first to comment.