The Dart SDK, including the VM, dart2js, core libraries, and more.

Last update: Aug 8, 2022

Dart

A client-optimized language for fast apps on any platform

Dart is:

  • Optimized for UI: Develop with a programming language specialized around the needs of user interface creation.

  • Productive: Make changes iteratively: use hot reload to see the result instantly in your running app.

  • Fast on all platforms: Compile to ARM & x64 machine code for mobile, desktop, and backend. Or compile to JavaScript for the web.

Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:

  • Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.

  • Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).

Dart platforms illustration

License & patents

Dart is free and open source.

See LICENSE and PATENT_GRANT.

Using Dart

Visit dart.dev to learn more about the language, tools, and to find codelabs.

Browse pub.dev for more packages and libraries contributed by the community and the Dart team.

Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).

Building Dart

If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.

There are more documents on our wiki.

Contributing to Dart

The easiest way to contribute to Dart is to file issues.

You can also contribute patches, as described in Contributing.

GitHub

https://github.com/dart-lang/sdk
Comments
  • 1. Meta-issue for discussion of the proposal to make semicolons after statements optional

    This issue is to provide a forum for community discussion and feedback related to the proposal to make semicolons optional after statements.

    This entry will be updated when a proposal is available.

    cc @munificent @eernstg @floitschG @lrhn

    cc @Hixie

    Reviewed by leafpetersen at 2017-08-07 22:50
  • 2. Design and implement Dart VM FFI

    The present feature tracks the implementation of Dart FFI support enabling interop with C & C++ code from Dart.

    Status

    The feature will be in stable as of Dart 2.12. More details here: https://dart.dev/guides/libraries/c-interop

    For any discussion of this feature, or feedback or questions regarding the feature, kindly join and post the dart-ffi group: https://groups.google.com/forum/#!forum/dart-ffi

    We will still actively adding new features to dart:ffi. Please refer to https://github.com/dart-lang/sdk/labels/library-ffi for open issues and feature requests.

    Background

    Some inspirational references:

    • http://luajit.org/ext_ffi.html
    • https://github.com/JetBrains/kotlin-native/blob/master/INTEROP.md
    • https://github.com/scala-native/scala-native/blob/master/docs/user/interop.rst
    Reviewed by mraleph at 2018-09-12 18:35
  • 3. Slow HttpClient operation caused by DNS resolution failure on iOS

    The issue has been discussed in flutter, move it here since it's more relevant.

    Our environment is iOS version: 13.3.1. iPhone 6S. (And some customers reported same problems on different devices, iPhone 7, iPhone X, latest iOS system as of now).

    As a reference, I created a flutter sample project, with

    flutter create --androidx -t app sample

    Then, add some code in main.dart to perform a simple http get request, whenever user clicks the + button and display the time spent. (https://gist.github.com/rxwen/009c7ae4328ee799f71013f06e206b13#file-main-dart-L55) This simplest example, exhibit the same behavior.

    Took about 5 second on wifi (On the same device, using safari can open the same page instantaneously under the same wifi connection)
    Took about 500 ms on 4G
    

    I run sample on flutter v1.12.13+hotfix.8, v1.9.1 in debug and release mode. All got the similar results.

    Further testing showed that it may be related to dns. I tried change the url to its ip address instead of domain name, the speed isn't slow at all. And if I set the iPhone's dns to manual mode, and remove the ipv6 dns server (which is configured automatically), the problem is gone too.

    So, here is the question, how come the ipv6 dns server will affect the flutter app's dns resolution? While other apps are not affected. It's not a feasible solution if we have to ask our app user to configure the dns manually when they encounter this problem. There still should be something different in dart code base that handle the dns in a different way.

    Reviewed by rxwen at 2020-04-11 16:07
  • 4. Auto import (or quickfix?) for Extensions

    I am opening this issue as @scheglov asked for at https://github.com/dart-lang/sdk/issues/25820#issuecomment-541972606

    I am having problem with auto completing the new Extension Functions from dart 2.6.0. I have added a new file called "time.dart" with some extensions, like this:

    image

    My main file just can't auto complete it. If I try to quickfix the error I get the following:

    image

    As soon as I move the extensions to the same file as main, everything works:

    image

    If I add the import manually, it also works:

    image

    My Dart for Intellij plugin version is 192.6817.14

    Reviewed by shinayser at 2019-10-15 14:58
  • 5. The "exclude" list in .analysis_options is ignored by the dartanalyzer cli

    When I define excludes in my .analysis_options file like this:

    analyzer:
      strong-mode: true
      exclude:
        - test/**
        - lib/generated_library/**
    

    files in lib/generated_library are still analyzed, when they are imported by other libraries in my project.

    I would expect not to get strong-mode warnings or lint errors in any files excluded in the exclude: list

    Reviewed by enyo at 2016-01-21 15:42
  • 6. Analysis painfully slow in IntelliJ after update

    Having updated IntelliJ to version 2016.3.2, Dart plugin to version 163.11306 and Dart SDK to 1.22.0-dev.6.0 analysis has become painfully slow.

    Changes like signature changes or removing/added interface members trigger reanalysis of a huge number of (sometimes completely unaffected) files often taking ~15 seconds, sometimes up to ~1 minute.

    Reviewed by johnniwinther at 2017-01-13 15:07
  • 7. Add public and private access modifiers to language

    Hello everyone, I've been analyzing the answers they gave me in issue #33104 33104, and I'll summarize them in a single proposal, which I consider a necessity and the most important, since the translation is not exact, I'll explain it with a couple of examples:

    • The proposal is: Add the reserved word public and private only.

    • An example with flutter.

    class CounterState extends State<Counter> {
    
      private int counter = 0;
    
      private void increment() {
        setState(() {
          this.counter++;
        });
      }
    
      private void decrement() {
        setState(() {
          this.counter--;
        });
      }
    
      public Widget build(BuildContext context) {
        return new Row(
          children: <Widget>[
            new RaisedButton(
              onPressed: this.increment,
              child: new Text('Increment'),
            ),
            new RaisedButton(
              onPressed: this.decrement,
              child: new Text('Decrement'),
            ),
            new Text('Count: $counter'),
          ],
        );
      }
    }
    
    • An example with dart
    class Person {
    
      private String firstName; 
      private String lastName;  
      private int age;        
    
      Person(this.firstName, this.lastName, this.age);
    
      public Map<String, dynamic> asMap() {
        return {
          'firstName': this.firstName,
          'lastName': this.lastName,
          'age': this.age
        };
      }
    
      String get firstName => this.firstName;
      String get lastName => this.lastName;
      int get age => this.age;
    }
    
    void main() {
      final Person x = new Person("Brayan", "Martinez", 23);
    
      print(x.firstName)
      print(x.asMap().toString());
    }
    
    • I hope you like this new version, and can convince them, what remains is to decearle the greatest possible success.
    Reviewed by Ing-Brayan-Martinez at 2018-06-07 16:17
  • 8. Non-nullable type annotation syntax

    This is the tracking bug for the real implementation of the postfix ? syntax to mark a type annotation as nullable as part of supporting non-nullable types (#28619). See the "Syntax" section of the proposal for details.

    Since we're still only in the prototype phase, consider this bug to be on hold. If we decide to go ahead and ship a real implementation, I'll update this.

    Flag

    While this is being implemented, to ensure we don't expose users to inconsistency in our tools, it should be put behind a flag named nnbd.

    Tracking issues

    • [x] Analyzer (#27232)
    • [ ] dart2js (#27232)
    • [ ] dev_compiler(#27234)
    • [ ] Formatter (https://github.com/dart-lang/dart_style/issues/536)
    • [ ] Specification (#27235)
    • [ ] VM (#27236)
    • [ ] IntelliJ-plugin (#27237)
    Reviewed by munificent at 2016-09-02 20:49
  • 9. Native executables created with dart2native do not support signing

    NOTE: This issue specifically refers to dart2native tool, it does not refer to Flutter on Desktop, as Flutter does not use dart2native

    The executables created with bin/dart2native use a format that as discussed in the original issue is not compatible with signing tools such as codesign and signtool.

    Reviewed by mit-mit at 2019-10-25 10:47
  • 10. [Breaking Change Request] Declare return types of Uint8List

    Current state

    The following methods all return Uint8List, yet they are only declared to return List<int>:

    • Utf8Codec.encode()
    • BytesBuilder.takeBytes()
    • BytesBuilder.toBytes()
    • File.readAsBytes()
    • File.readAsBytesSync()
    • RandomAccessFile.read()
    • RandomAccessFile.readSync()
    • Uint8List.sublist()

    Relatedly, the following sublist() methods return sublists of the same type as the source list, yet they only declare that they return the more generic type (e.g. List<int>, List<float>, or List<double>):

    • Int8List
    • Uint8ClampedList
    • Int16List
    • Uint16List
    • Int32List
    • Uint32List
    • Int64List
    • Uint64List
    • Float32List
    • Float64List
    • Float32x4List
    • Int32x4List
    • Float64x2List

    Intended change

    This issues proposes to update the API of the aforementioned methods to declare the return value of the more specific return type (e.g. Uint8List rather than List<int>).

    Rationale

    1. Better type safety

      Callers would like to statically prove that you can obtain a ByteBuffer from the result of these API calls.

    2. The current API/implementation combo encourages bad practices.

      There are two dangers with an API saying it returns List<int> and always returning Uint8List:

      1. People do roundabout things to guarantee that the result is a Uint8List (such as defensively wrapping the result in a Uint8List), which causes unnecessary overhead.
      2. People start to depend on the result being a Uint8List and automatically performing a contravariant cast (which is already happening in Flutter and elsewhere) -- and if anyone new implements the interface and returns something other than a Uint8List, code breaks.
    3. To match the documentation

      Utf8Encoder and Base64Decoder.convert, for instance, already document that they return Uint8List.

    See also:

    • Bug #27818
    • Bug #31547
    • Bug #31784
    • Bug #35521

    Expected impact

    On callers

    Callers of these APIs will not be impacted at all since the new return types are subtypes of the existing return types (and moreover, the return values will be the exact same values).

    On implementations of the interfaces

    Libraries that are implementing the following interfaces will be broken because they will no longer be implementing the interface:

    • Utf8Encoder
    • BytesBuilder
    • File
    • RandomAccessFile
    • Int8List
    • Uint8List
    • Uint8ClampedList
    • Int16List
    • Uint16List
    • Int32List
    • Uint32List
    • Int64List
    • Uint64List
    • Float32List
    • Float64List
    • Float32x4List
    • Int32x4List
    • Float64x2List

    This includes (but is not limited to) some well-known packages, such as package:typed_data and package:file.

    Steps for mitigation

    For known affected packages, the plan will be to issue patch releases to those packages that tighten the SDK constraints to declare that the current version of the package is not compatible with an SDK version greater than the current dev version. Then, once the change lands, we'll update the affected packages to implement the new API and loosen their SDK constraints once again.

    Reviewed by tvolkert at 2019-05-08 22:03
  • 11. DartAnalyzer stops working from time to time / autocompletion in IntelliJ fails

    I know the subject sound weird but thats how it is. The IDEA Team is really helpful but I'm almost sure this is not their fault but it's a "Analyzer Server problem" https://youtrack.jetbrains.com/issue/WEB-18020

    THIS REALLY DRIVES ME CRAZY I know my project is big and has quite a few modules but Dart is almost 4 years old, I'm working with one of the best IDEs and at the moment it's like working with Notepad+syntax highlighting.

    It costs me about one hour per day restarting the IDE, waiting for DartAnalyzer, restarting again, writing ISSUE-reports and so on. It's like being in a Beta-Program...

    Reviewed by MikeMitterer at 2015-11-03 16:03
  • 12. CFE: Error context not updated on in-body change

    When an in-body change occurs in a library that is used in the context of another error message, the message is not updated.

    This can currently be seen in incremental/regress_35215 and incremental/regress_35215_prime where the output of the world compilations result in the same messages.

    Reviewed by johnniwinther at 2022-08-10 13:51
  • 13. Sometimes crash on Mac M1

    [email protected]:~/Source/Dart/sdk.git/sdk (aa-publish)$ d-rts
    Total 447 tests, of which 104 are expected to fail.
    00:53 +4962: analysis_server | lsp | CompletionTest | test_completeFunctionCalls_resolve_producesCorrectEditWithoutInsertText
    ===== CRASH =====
    si_signo=Segmentation fault: 11(11), si_code=2, si_addr=0x0
    version=2.18.0-edge.a37502c1b88a7fa3277531b37a5b075169a8f9c1 (be) (Tue Jun 28 16:02:53 2022 +0000) on "macos_arm64"
    pid=57064, thread=20999, isolate_group=main(0x12700c400), isolate=main(0x12701bc00)
    isolate_instructions=10425f7e0, vm_instructions=10425f7e0
    Stack dump aborted because InitialRegisterCheck failed.
    /Users/scheglov/bin/d-rts: line 11: 57064 Abort trap: 6           dart /Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analysis_server/test/test_all.dart
    
    real	1m3.397s
    user	1m11.088s
    sys	0m5.688s
    
    [email protected]:~/Source/Dart/sdk.git/sdk (aa-publish)$ dart --version
    Dart SDK version: 2.18.0-edge.a37502c1b88a7fa3277531b37a5b075169a8f9c1 (be) (Tue Jun 28 16:02:53 2022 +0000) on "macos_arm64"
    [email protected]:~/Source/Dart/sdk.git/sdk (aa-publish)$ uname -a
    Darwin scheglov-macbookpro4.roam.internal 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000 arm64
    

    I think this happens most often when I run this set of tests in parallel with another one or two tests in different console tabs.

    Reviewed by scheglov at 2022-08-09 22:40
  • 14. Avoid false positives applying Google3 specific functionality to non-google3 specific bazel workspaces

    Related issue: https://github.com/dart-lang/sdk/issues/49544 The cherry pick was fine to unblock but I think the right solution to this is to stop treating non-g3 BAZEL workspaces as BAZEL workspaces as we don't really support that case anyway. To detect g3 bazel workspaces we should check for the magic dart/config/ide/flutter.json file like the Flutter IntellIJ support does. See https://github.com/flutter/flutter-intellij/blob/e6bb872cca41d5bcdaebc073c6c6882f3fc22633/flutter-idea/src/io/flutter/bazel/Workspace.java#L34 That should avoid false positives like this and keep our different tools consistent.

    Reviewed by jacob314 at 2022-08-09 22:07
  • 15. Confusing error message when dynamically calling a null value

    dcall(f, args, [@undefined named]) => _checkAndCall(
        f, null, JS('', 'void 0'), null, args, named, JS('', 'f.name'));
    
    dgcall(f, typeArgs, args, [@undefined named]) => _checkAndCall(f, null,
        JS('', 'void 0'), typeArgs, args, named, JS('', "f.name || 'call'"));
    

    Both of these methods attempt to pass f.name as the displayName argument to _checkAndCall(). When f is null the error messages are misleading and the code in _checkAndCall() meant to handle null and provide a more helpful error message is not being executed.

    ex:

    Uncaught TypeError: Cannot read properties of null (reading 'name')
        at Object.dcall (dart_sdk.js:4914:69)
        at Object.main (test_05.js:37:10)
        at test_05.html:19:17
        at Object.execCb (require.js:1696:33)
        at Module.check (require.js:883:51)
        at Module.<anonymous> (require.js:1139:34)
        at require.js:134:23
        at require.js:1189:21
        at each (require.js:59:31)
        at Module.emit (require.js:1188:17)
        at Module.check (require.js:938:30)
        at Module.<anonymous> (require.js:1139:34)
        at require.js:134:23
        at require.js:1189:21
        at each (require.js:59:31)
        at Module.emit (require.js:1188:17)
        at Module.check (require.js:938:30)
        at Module.enable (require.js:1176:22)
        at Module.init (require.js:788:26)
        at callGetModule (require.js:1203:63)
        at Object.completeLoad (require.js:1590:21)
        at HTMLScriptElement.onScriptLoad (require.js:1717:29)
    
    Reviewed by nshahan at 2022-08-09 21:48
  • 16. Deprecate KeyboardEvent.keyCode in dart:html

    The KeyboardEvent.keyCode property is deprecated in favor of KeyboardEvent.code, which is supported by all browsers except IE.

    dart:html still provides keyCode along with all the KeyCode values. We should mark keyCode and the KeyCode values as deprecated in dart:html so that users know to migrate to the recommended replacement.

    Reviewed by rileyporter at 2022-08-09 21:46

Related

Tooling and libraries for processing dart test output into dev-friendly formats

better_test_reporter Introduction This is an application/library heavily inspired by dart-junitreport and dart-testreport. It takes what was done in t

Feb 23, 2022
Libraries supporting GraphQL in Dart

gql-dart/gql This is an effort to advance the Dart GraphQL ecosystem. It consists of multiple packages and libraries centered around GraphQL AST. Core

Aug 8, 2022
GetDoctor is a complete app developed in Flutter, Firebase and Blazor,.Net Core API and SQL Server
GetDoctor is a complete app developed in Flutter, Firebase and Blazor,.Net Core API and SQL Server

GetDoctor ?? ?? ?? GetDoctor is a complete app developed in Flutter, Firebase and Blazor,DotNet Core API and SQL Server GetDoctor is a complete packag

Aug 8, 2022
A complete grocery store developed with Flutter, .Net Core, Firebase, One Signal and SQL Server as backend
A complete grocery store developed with  Flutter, .Net Core, Firebase, One Signal and SQL Server as backend

# Grocery-Store developed in Flutter,DotNet Core, Firebase, One-Signal, SQL-Server, Stripe, Razorpay, Paypal A complete grocery store developed with F

Jul 11, 2022
A Flutter application implementing AR core, Text-to-speech, and Speech-to-text technologies.

ar_x_ai A Flutter application implementing AR core, Text to speech and Speech to text technologies. Getting Started This project is a starting point f

Dec 17, 2021
Passwall Server is the core backend infrastructure for Passwall platform

PassWall Server PassWall Server is the core backend for open source password manager PassWall platform. Using this server, you can safely store your p

Aug 18, 2022
A Package providing Core functionality/Template to start off a Clean Architecture based project

A Package providing Core functionality/Template to start off a Clean Architecture based project Features Provides with APIResult & UseCaseResult model

Dec 25, 2021
An app to show everything bus related in Singapore, including arrival times and a directory
An app to show everything bus related in Singapore, including arrival times and a directory

NextBus SG An app to show everything bus related in Singapore, including bus arrival times and a directory, with extra features. ?? Gallery Click here

Aug 7, 2022
Audio manager - A flutter plugin for music playback, including notification handling.
Audio manager - A flutter plugin for music playback, including notification handling.

audio_manager A flutter plugin for music playback, including notification handling. This plugin is developed for iOS based on AVPlayer, while android

Jul 18, 2022
Expenses tracker built with Flutter and Dart making use of Provider, Intl, Syncfusion Flutter Datepicker and more

expense_app A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Dec 13, 2021
Stream Feed official Flutter SDK. Build your own feed experience using Dart and Flutter.
Stream Feed official Flutter SDK. Build your own feed experience using Dart and Flutter.

Official Flutter packages for Stream Activity Feeds The official Dart client for Stream Activity Feeds, a service for building activity feed applicati

Jul 22, 2022
Pensil Community official Flutter SDK. Build your own community experience using Dart and Flutter.

Official flutter package for Pensil The official Dart client for Pensil communities, a service for building communites applications. This library can

Feb 20, 2022
Task List application developed in Dart language with SDK Flutter for Android, iOS and Web
Task List application developed in Dart language with SDK Flutter for Android, iOS and Web

Task List application developed in Dart language with SDK (Software Development Kit) Flutter for Android, iOS and Web.

Jun 2, 2022
The official sdk for the user-friendly API of Mega services on the Dart language.

megasdkdart The official sdk for the user-friendly API of Mega services in the Dart language. Example: import 'package:megasdkdart/megasdkdart.dart';

Mar 30, 2022
Unofficial Dart SDK for Decentralized Social / DeSo.org
Unofficial Dart SDK for Decentralized Social / DeSo.org

DeSo Dart SDK Unofficial Dart SDK for Decentralized Social / DeSo.org Report Bug ยท Request Feature Table of Contents About the Project Built With Gett

Apr 29, 2022
Dart SDK for Dapr.

Dapr dart sdk Welcome to the dart-sdk for dapr. This repository aims to provide and maintain the dart packages required to interact with dapr sidecar.

Mar 20, 2022
FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.
FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.

File Manager FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to fee

Aug 10, 2022
A new practical project made with Flutter and some native widgets, movie API, provider state and more.
A new practical project made with Flutter and some native widgets, movie API, provider state and more.

Flutter Movie App This project was created with Flutter and some native Widgets like SingleChildScrollView, Hero Animation, SliverAppBar, StreamBuilde

Jul 12, 2022
BankGit helps you manage your account and transactions more efficiently by breaking your account into branches for various purposes and then making transactions directly from them.
BankGit helps you manage your account and transactions more efficiently by breaking your account into branches for various purposes and then making transactions directly from them.

Bank Git Web Hosted Here : https://bank-management-45848.web.app/ Bank Git is an application built with Flutter and Firebase to help you manage your b

Apr 20, 2022