Description #
Dart is a client-optimized programming language developed by Google for building fast, modern web, mobile, and desktop apps. It is best known as the language behind Flutter, Google’s UI toolkit for crafting natively compiled applications.
History #
Dart was introduced by Google in 2011 to address limitations in JavaScript when developing large-scale applications. It started as a language that compiled to JavaScript and evolved to power Flutter in 2017, gaining traction for cross-platform development. Dart supports both ahead-of-time (AOT) and just-in-time (JIT) compilation.
Key milestones include:
- 2011: Public release as a JavaScript alternative
- 2017: Became the foundation for Flutter
- 2020+: Used in production apps by Google, Alibaba, and others
- 2024: Dart 3 added records and pattern matching
Hello World Code #
void main() {
print('Hello, World!');
}
How to Run #
Online:
Visit https://dartpad.dev, paste the code, and click “Run”.
Locally:
- Install the Dart SDK from https://dart.dev/get-dart
- Save your file as
hello.dart
- Run in terminal:
dart hello.dart
Key Concepts #
main()
is the entry point of a Dart programprint()
outputs to the console- Strong static typing with optional inference
- Null safety ensures variables are non-nullable by default
- Supports both OOP and functional programming styles
- Asynchronous support via
async
,await
,Future
, andStream
- Compiles to native code and JavaScript
- Uses packages from https://pub.dev
- Designed to integrate tightly with Flutter
- Runs on all platforms: web, mobile, desktop, CLI
Try It Online #
Fun Facts #
- Dart’s mascot is Dash, a blue cartoon bird
- Flutter apps built with Dart run on Android, iOS, Windows, macOS, and Linux
- Dart combines the readability of JavaScript with the performance of native languages
- Its syntax is familiar to developers coming from Java, Kotlin, or C#
- The Dart ecosystem includes command-line apps, REST APIs, and web UIs