PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Dart

Dart

Dart is a programming language created in 2011 by Lars Bak.

Dart is a general-purpose programming language originally developed by Google and later approved as a standard by Ecma (ECMA-408). It is used to build web, server and mobile applications, and for Internet of Things (IoT) devices. It is open-source software under a permissive free software license (modified BSD license). Read more on Wikipedia...

Try now: Riju · TIO

#47on PLDB 11Years Old 38.3kUsers

Example code from Riju:

void main() { print('Hello, world!'); }

Example code from hello-world:

main() { print('Hello World'); }

Example code from the Hello World Collection:

// Hello world in Dart main() { print('Hello world!'); }

Example code from Linguist:

import 'dart:math' as math; class Point { num x, y; Point(this.x, this.y); num distanceTo(Point other) { var dx = x - other.x; var dy = y - other.y; return math.sqrt(dx * dx + dy * dy); } } void main() { var p = new Point(2, 3); var q = new Point(3, 4); print('distance from p to q = ${p.distanceTo(q)}'); }

Example code from Wikipedia:

// Import the math library to get access to the sqrt function. import 'dart:math' as math; // Create a class for Point. class Point { // Final variables cannot be changed once they are assigned. // Create two instance variables. final num x, y; // A constructor, with syntactic sugar for setting instance variables. Point(this.x, this.y); // A named constructor with an initializer list. Point.origin() : x = 0, y = 0; // A method. num distanceTo(Point other) { var dx = x - other.x; var dy = y - other.y; return math.sqrt(dx * dx + dy * dy); } // Example of Operator Overloading Point operator +(Point other) => new Point(x + other.x, y + other.y); } // All Dart programs start with main(). void main() { // Instantiate point objects. var p1 = new Point(10, 10); var p2 = new Point.origin(); var distance = p1.distanceTo(p2); print(distance); }

Keywords in Dart

abstract as assert async await break case catch class const continue covariant default deferred do dynamic else enum export extends external factory false final finally for get if implements import in is library new null operator part rethrow return set static super switch sync this throw true try typedef var void while with yield

Language features

Feature Supported Example Token
Hexadecimals ✓
// 0[xX][0-9a-fA-F]+
Conditionals ✓
Async Await ✓
Inheritance ✓
Switch Statements ✓
Exceptions ✓
Constants ✓
Classes ✓
While Loops ✓
Booleans ✓ true false
Strings ✓
'Hello world'
'
Regular Expression Syntax Sugar ✓
Print() Debugging ✓ print
Line Comments ✓
// A comment
//
Operator Overloading ✓
File Imports ✓
import 'file-system.dart';
import 'dart:math' as math;
MultiLine Comments ✓
/* A comment
*/
/* */
Comments ✓
// Hi
/* Assume address is not null. */
Semantic Indentation Ï´

Trending Dart repos on GitHub

repo stars description
flutter_ui_challenges 913 Trying to replicate various app UIs in flutter
flutter-tutorials 735 The repo contains the source code for all the tutorials on the FilledStacks Youtube channel.
flutter-go 16608 flutter 开发者帮助 APP,包含 flutter 常用 140+ 组件的demo 演示与中文文档
mobx.dart 763 "MobX for the Dart language. Hassle-free reactive state-management for your Dart and Flutter apps."
flutter 74265 Flutter makes it easy and fast to build beautiful mobile apps.
flutter_easyrefresh 1101 A widget provided to the flutter scroll component pull-refresh and push-load.
GDG-DevFest-App 364 An App Template For GDG DevFest
TheGorgeousLogin 834 Login page built with @flutter 😍
bloc 2455 A predictable state management library that helps implement the BLoC design pattern
flutter-todos 692 "📝 全面而又精美的Flutter Todo-List app 除了适合日常使用,作为flutter的实践项目也是超级合适的哟!"
flutter_screenutil 1010 "Flutter screen adaptation font adaptation get screen information"
Flutter-Story-App-UI 414
hive 325 Lightweight and blazing fast key-value database written in pure Dart.
plugins 7934 "Plugins for Flutter including FlutterFire maintained by the Flutter team"
multi_image_picker 410 Flutter plugin that allows you to display multi image picker on iOS and Android. 👌🔝🎉
fluttergram 786 A fully functional Instagram clone written in Flutter using Firebase / Firestore
samples 3985 A collection of Flutter examples and demos.
flutter_web 4411 Bring your Flutter code to web browsers
flutter_architecture_samples 3791 TodoMVC for Flutter
zefyr 772 Soft and gentle rich text editing for Flutter applications.
flutter-chat-demo 413 This is the demo for chat app by Flutter
flutter_pulltorefresh 748 a widget provided to the flutter scroll component drop-down refresh and pull up load.
fluro 1703 "Fluro is a Flutter routing library that adds flexible routing options like wildcards named parameters and clear route definitions."
uber_clone 363
flutter_blue 834 Bluetooth plugin for Flutter

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements · Email · GitHub