CINXE.COM

FAQ | Dart

<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="ie=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><script>!function(e,t,a,n){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var g=t.getElementsByTagName(a)[0],m=t.createElement(a);m.async=!0,m.src="https://www.googletagmanager.com/gtm.js?id=GTM-5VSZM5J",g.parentNode.insertBefore(m,g)}(window,document,"script","dataLayer")</script><meta name="description" content="You have questions about Dart, we have answers."><title>FAQ | Dart</title><link rel="icon" sizes="64x64" href="/assets/img/logo/dart-64.png" eleventy:ignore><link href="/assets/img/touch-icon-iphone.png" rel="apple-touch-icon" eleventy:ignore><link href="/assets/img/touch-icon-ipad.png" rel="apple-touch-icon" sizes="152x152" eleventy:ignore><link href="/assets/img/touch-icon-iphone-retina.png" rel="apple-touch-icon" sizes="180x180" eleventy:ignore><link href="/assets/img/touch-icon-ipad-retina.png" rel="apple-touch-icon" sizes="167x167" eleventy:ignore><meta name="twitter:card" content="summary"><meta name="twitter:site" content="@dart_lang"><meta name="twitter:title" content="Dart FAQ"><meta name="twitter:description" content="You have questions about Dart, we have answers."><meta property="og:title" content="Dart FAQ"><meta property="og:description" content="You have questions about Dart, we have answers."><meta property="og:url" content="/resources/faq/"><meta property="og:image" content="/assets/img/logo/dart-logo-for-shares.png?2" eleventy:ignore><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Google+Sans+Display:wght@400&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Google+Sans+Mono:wght@400;500;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Google+Sans+Text:wght@400;500;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" rel="stylesheet"><link rel="stylesheet" href="/assets/css/main.css"><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.2/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+" crossorigin="anonymous" referrerpolicy="no-referrer"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/js-cookie/3.0.5/js.cookie.min.js" integrity="sha512-nlp9/l96/EpjYBx7EP7pGASVXNe80hGhYAUrjeXnu/fyF5Py0/RXav4BBNs7n5Hx1WFhOEOWSAVjGeC3oKxDVQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script><script src="/assets/js/os-tabs.js"></script><script src="/assets/js/utilities.js"></script><script src="/assets/js/main.js"></script><script>!function(e,a,t,n,c,o,s){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,o=a.createElement(t),s=a.getElementsByTagName(t)[0],o.async=1,o.src="//www.google-analytics.com/analytics.js",s.parentNode.insertBefore(o,s)}(window,document,"script",0,"ga"),ga("create","UA-26406144-4","auto"),ga("send","pageview")</script></head><body class="default.html show_banner"><a id="skip" href="#site-content-title">Skip to main content</a><section id="cookie-notice"><div class="container"><p>dart.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic. <a href="https://policies.google.com/technologies/cookies" target="_blank" rel="noopener">Learn more</a>.</p><button id="cookie-consent" class="btn btn-primary">OK, got it</button></div></section><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5VSZM5J" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><header id="page-header" class="site-header"><nav id="mainnav" class="site-header"><div id="menu-toggle"><i class="material-symbols">menu</i></div><a href="/" class="brand" title="Dart"><img src="/assets/img/logo/logo-white-text.svg" alt="Dart"></a><ul class="navbar"><li><a href="/overview" class="nav-link">Overview</a></li><li class="mainnav__get-started"><a href="/guides" class="nav-link active"><span>Docs</span></a></li><li><a href="/community" class="nav-link">Community</a></li><li><a href="/#try-dart" class="nav-link">Try Dart</a></li><li><a href="/get-dart" class="nav-link">Get Dart</a></li><li class="searchfield"><form action="/search" class="site-header__search form-inline" id="cse-search-box"><input type="hidden" name="cx" value="011220921317074318178:_yy-tmb5t_i"> <input type="hidden" name="ie" value="UTF-8"> <input type="hidden" name="hl" value="en"> <input class="site-header__searchfield form-control search-field" type="search" name="q" id="search-main" autocomplete="off" placeholder="Search" aria-label="Search"></form></li></ul></nav></header><div class="banner"><p class="banner__text">Announcing Dart 3.5 and an updated Dart roadmap! <a href="https://medium.com/dartlang/dart-3-5-6ca36259fa2f" target="_blank">Learn more</a></p></div><div id="sidenav"><form action="/search/" class="site-header__search form-inline"><input class="site-header__searchfield form-control search-field" type="search" name="q" id="search-side" autocomplete="off" placeholder="Search" aria-label="Search"></form><div class="site-sidebar"><ul class="navbar-nav"><li class="nav-item"><a href="/overview" class="nav-link">Overview</a></li><li class="nav-item"><a href="/community" class="nav-link">Community</a></li><li class="nav-item"><a href="https://dartpad.dev" class="nav-link">Try Dart</a></li><li class="nav-item"><a href="/get-dart" class="nav-link">Get Dart</a></li><li class="nav-item"><a href="/guides" class="nav-link">Docs</a></li><li aria-hidden="true"><div class="sidebar-primary-divider"></div></li></ul><ul class="nav flex-column"><li class="nav-item"><a class="nav-link collapsed collapsible" data-toggle="collapse" href="#sidenav-1" role="button" aria-expanded="false" aria-controls="sidenav-1">Language</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-1"><li class="nav-item"><a class="nav-link" href="/language">Introduction</a></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-1-2" href="#sidenav-1-2" role="button" aria-expanded="false" aria-controls="sidenav-1-2">Syntax basics</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-1-2"><li class="nav-item"><a class="nav-link" href="/language/variables">Variables</a></li><li class="nav-item"><a class="nav-link" href="/language/operators">Operators</a></li><li class="nav-item"><a class="nav-link" href="/language/comments">Comments</a></li><li class="nav-item"><a class="nav-link" href="/language/metadata">Metadata</a></li><li class="nav-item"><a class="nav-link" href="/language/libraries">Libraries & imports</a></li><li class="nav-item"><a class="nav-link" href="/language/keywords">Keywords</a></li></ul></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-1-3" href="#sidenav-1-3" role="button" aria-expanded="false" aria-controls="sidenav-1-3">Types</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-1-3"><li class="nav-item"><a class="nav-link" href="/language/built-in-types">Built-in types</a></li><li class="nav-item"><a class="nav-link" href="/language/records">Records</a></li><li class="nav-item"><a class="nav-link" href="/language/collections">Collections</a></li><li class="nav-item"><a class="nav-link" href="/language/generics">Generics</a></li><li class="nav-item"><a class="nav-link" href="/language/typedefs">Typedefs</a></li><li class="nav-item"><a class="nav-link" href="/language/type-system">Type system</a></li></ul></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-1-4" href="#sidenav-1-4" role="button" aria-expanded="false" aria-controls="sidenav-1-4">Patterns</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-1-4"><li class="nav-item"><a class="nav-link" href="/language/patterns">Overview & usage</a></li><li class="nav-item"><a class="nav-link" href="/language/pattern-types">Pattern types</a></li><li class="nav-item"><a class="nav-link" href="https://codelabs.developers.google.com/codelabs/dart-patterns-records" target="_blank" rel="noopener">Applied tutorial</a></li></ul></li><li class="nav-item"><a class="nav-link" href="/language/functions">Functions</a></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-1-6" href="#sidenav-1-6" role="button" aria-expanded="false" aria-controls="sidenav-1-6">Control flow</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-1-6"><li class="nav-item"><a class="nav-link" href="/language/loops">Loops</a></li><li class="nav-item"><a class="nav-link" href="/language/branches">Branches</a></li><li class="nav-item"><a class="nav-link" href="/language/error-handling">Error handling</a></li></ul></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-1-7" href="#sidenav-1-7" role="button" aria-expanded="false" aria-controls="sidenav-1-7">Classes & objects</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-1-7"><li class="nav-item"><a class="nav-link" href="/language/classes">Classes</a></li><li class="nav-item"><a class="nav-link" href="/language/constructors">Constructors</a></li><li class="nav-item"><a class="nav-link" href="/language/methods">Methods</a></li><li class="nav-item"><a class="nav-link" href="/language/extend">Extend a class</a></li><li class="nav-item"><a class="nav-link" href="/language/mixins">Mixins</a></li><li class="nav-item"><a class="nav-link" href="/language/enums">Enums</a></li><li class="nav-item"><a class="nav-link" href="/language/extension-methods">Extension methods</a></li><li class="nav-item"><a class="nav-link" href="/language/extension-types">Extension types</a></li><li class="nav-item"><a class="nav-link" href="/language/callable-objects">Callable objects</a></li></ul></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-1-8" href="#sidenav-1-8" role="button" aria-expanded="false" aria-controls="sidenav-1-8">Class modifiers</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-1-8"><li class="nav-item"><a class="nav-link" href="/language/class-modifiers">Overview & usage</a></li><li class="nav-item"><a class="nav-link" href="/language/class-modifiers-for-apis">Class modifiers for API maintainers</a></li><li class="nav-item"><a class="nav-link" href="/language/modifier-reference">Reference</a></li></ul></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-1-9" href="#sidenav-1-9" role="button" aria-expanded="false" aria-controls="sidenav-1-9">Concurrency</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-1-9"><li class="nav-item"><a class="nav-link" href="/language/concurrency">Overview</a></li><li class="nav-item"><a class="nav-link" href="/language/async">Asynchronous support</a></li><li class="nav-item"><a class="nav-link" href="/language/isolates">Isolates</a></li></ul></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-1-10" href="#sidenav-1-10" role="button" aria-expanded="false" aria-controls="sidenav-1-10">Null safety</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-1-10"><li class="nav-item"><a class="nav-link" href="/null-safety">Sound null safety</a></li><li class="nav-item"><a class="nav-link" href="/null-safety/migration-guide">Migrating to null safety</a></li><li class="nav-item"><a class="nav-link" href="/null-safety/understanding-null-safety">Understanding null safety</a></li><li class="nav-item"><a class="nav-link" href="/null-safety/unsound-null-safety">Unsound null safety</a></li><li class="nav-item"><a class="nav-link" href="/null-safety/faq">FAQ</a></li></ul></li></ul></li><li class="nav-item"><a class="nav-link collapsed collapsible" data-toggle="collapse" href="#sidenav-2" role="button" aria-expanded="false" aria-controls="sidenav-2">Core libraries</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-2"><li class="nav-item"><a class="nav-link" href="/libraries">Overview</a></li><li class="nav-item"><a class="nav-link" href="/libraries/dart-core">dart:core</a></li><li class="nav-item"><a class="nav-link" href="/libraries/dart-async">dart:async</a></li><li class="nav-item"><a class="nav-link" href="/libraries/dart-math">dart:math</a></li><li class="nav-item"><a class="nav-link" href="/libraries/dart-convert">dart:convert</a></li><li class="nav-item"><a class="nav-link" href="/libraries/dart-io">dart:io</a></li><li class="nav-item"><a class="nav-link" href="/libraries/dart-html">dart:html</a></li><div class="dropdown-divider"></div><li class="nav-item"><a class="nav-link" href="/libraries/collections/iterables">Iterable collections</a></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-2-10" href="#sidenav-2-10" role="button" aria-expanded="false" aria-controls="sidenav-2-10">Asynchronous programming</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-2-10"><li class="nav-item"><a class="nav-link" href="/libraries/async/async-await">Tutorial</a></li><li class="nav-item"><a class="nav-link" href="/libraries/async/futures-error-handling">Futures and error handling</a></li><li class="nav-item"><a class="nav-link" href="/libraries/async/using-streams">Using streams</a></li><li class="nav-item"><a class="nav-link" href="/libraries/async/creating-streams">Creating streams</a></li></ul></li></ul></li><li class="nav-item"><a class="nav-link collapsed collapsible" data-toggle="collapse" href="#sidenav-3" role="button" aria-expanded="false" aria-controls="sidenav-3">Effective Dart</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-3"><li class="nav-item"><a class="nav-link" href="/effective-dart">Overview</a></li><li class="nav-item"><a class="nav-link" href="/effective-dart/style">Style</a></li><li class="nav-item"><a class="nav-link" href="/effective-dart/documentation">Documentation</a></li><li class="nav-item"><a class="nav-link" href="/effective-dart/usage">Usage</a></li><li class="nav-item"><a class="nav-link" href="/effective-dart/design">Design</a></li></ul></li><li class="nav-item"><a class="nav-link collapsed collapsible" data-toggle="collapse" href="#sidenav-4" role="button" aria-expanded="false" aria-controls="sidenav-4">Packages</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-4"><li class="nav-item"><a class="nav-link" href="/tools/pub/packages">How to use packages</a></li><li class="nav-item"><a class="nav-link" href="/resources/useful-packages">Commonly used packages</a></li><li class="nav-item"><a class="nav-link" href="/guides/libraries/create-packages">Creating packages</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/publishing">Publishing packages</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/writing-package-pages">Writing package pages</a></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-4-6" href="#sidenav-4-6" role="button" aria-expanded="false" aria-controls="sidenav-4-6">Package reference</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-4-6"><li class="nav-item"><a class="nav-link" href="/tools/pub/dependencies">Dependencies</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/glossary">Glossary</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/package-layout">Package layout conventions</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/environment-variables">Pub environment variables</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/pubspec">Pubspec file</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/troubleshoot">Troubleshooting pub</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/verified-publishers">Verified publishers</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/security-advisories">Security advisories</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/versioning">Versioning</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/custom-package-repositories">Custom package repositories</a></li></ul></li><li class="nav-item"><a class="nav-link" href="/guides/libraries/private-files">What not to commit</a></li></ul></li><li class="nav-item"><a class="nav-link collapsed collapsible" data-toggle="collapse" href="#sidenav-5" role="button" aria-expanded="false" aria-controls="sidenav-5">Development</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-5"><li class="nav-item"><a class="nav-link" href="/guides/json">JSON</a></li><li class="nav-item"><a class="nav-link" href="/guides/language/numbers">Number representation</a></li><li class="nav-item"><a class="nav-link" href="/resources/google-apis">Google APIs</a></li><li class="nav-item"><a class="nav-link" href="/multiplatform-apps">Multi-platform apps</a></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-5-5" href="#sidenav-5-5" role="button" aria-expanded="false" aria-controls="sidenav-5-5">Command-line & server apps</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-5-5"><li class="nav-item"><a class="nav-link" href="/server">Overview</a></li><li class="nav-item"><a class="nav-link" href="/tutorials/server/get-started">Get started</a></li><li class="nav-item"><a class="nav-link" href="/tutorials/server/cmdline">Write command-line apps</a></li><li class="nav-item"><a class="nav-link" href="/tutorials/server/fetch-data">Fetch data from the internet</a></li><li class="nav-item"><a class="nav-link" href="/tutorials/server/httpserver">Write HTTP servers</a></li><li class="nav-item"><a class="nav-link" href="/server/libraries">Libraries & packages</a></li><li class="nav-item"><a class="nav-link" href="/server/google-cloud">Google Cloud</a></li></ul></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-5-6" href="#sidenav-5-6" role="button" aria-expanded="false" aria-controls="sidenav-5-6">Web apps</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-5-6"><li class="nav-item"><a class="nav-link" href="/web">Overview</a></li><li class="nav-item"><a class="nav-link" href="/web/get-started">Get started</a></li><li class="nav-item"><a class="nav-link" href="/web/deployment">Deployment</a></li><li class="nav-item"><a class="nav-link" href="/web/libraries">Libraries & packages</a></li><li class="nav-item"><a class="nav-link" href="/web/wasm">Wasm compilation</a></li></ul></li><li class="nav-item"><a class="nav-link" href="/guides/environment-declarations">Environment declarations</a></li></ul></li><li class="nav-item"><a class="nav-link collapsed collapsible" data-toggle="collapse" href="#sidenav-6" role="button" aria-expanded="false" aria-controls="sidenav-6">Interoperability</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-6"><li class="nav-item"><a class="nav-link" href="/interop/c-interop">C interop</a></li><li class="nav-item"><a class="nav-link" href="/interop/objective-c-interop">Objective-C & Swift interop</a></li><li class="nav-item"><a class="nav-link" href="/interop/java-interop">Java & Kotlin interop</a></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-6-4" href="#sidenav-6-4" role="button" aria-expanded="false" aria-controls="sidenav-6-4">JavaScript interop</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-6-4"><li class="nav-item"><a class="nav-link" href="/interop/js-interop">Overview</a></li><li class="nav-item"><a class="nav-link" href="/interop/js-interop/usage">Usage</a></li><li class="nav-item"><a class="nav-link" href="/interop/js-interop/js-types">JS types</a></li><li class="nav-item"><a class="nav-link" href="/interop/js-interop/tutorials">Tutorials</a></li><li class="nav-item"><a class="nav-link" href="/interop/js-interop/past-js-interop">Past JS interop</a></li><div class="dropdown-divider"></div><li class="nav-item"><a class="nav-link" href="/interop/js-interop/package-web">Web interop</a></li></ul></li></ul></li><li class="nav-item"><a class="nav-link collapsed collapsible" data-toggle="collapse" href="#sidenav-7" role="button" aria-expanded="false" aria-controls="sidenav-7">Tools & techniques</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-7"><li class="nav-item"><a class="nav-link" href="/tools">Overview</a></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-7-2" href="#sidenav-7-2" role="button" aria-expanded="false" aria-controls="sidenav-7-2">Editors & debuggers</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-7-2"><li class="nav-item"><a class="nav-link" href="/tools/jetbrains-plugin">IntelliJ & Android Studio</a></li><li class="nav-item"><a class="nav-link" href="/tools/vs-code">VS Code</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-devtools">Dart DevTools</a></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-7-2-4" href="#sidenav-7-2-4" role="button" aria-expanded="false" aria-controls="sidenav-7-2-4">DartPad</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-7-2-4"><li class="nav-item"><a class="nav-link" href="/tools/dartpad">Overview</a></li><li class="nav-item"><a class="nav-link" href="/tools/dartpad/troubleshoot">Troubleshooting DartPad</a></li></ul></li></ul></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-7-3" href="#sidenav-7-3" role="button" aria-expanded="false" aria-controls="sidenav-7-3">Command-line tools</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-7-3"><li class="nav-item"><a class="nav-link collapsible" data-toggle="collapse" data-target="#sidenav-7-3-1" href="#sidenav-7-3-1" role="button" aria-expanded="true" aria-controls="sidenav-7-3-1">Dart SDK</a><ul class="nav flex-column flex-nowrap collapse show" id="sidenav-7-3-1"><li class="nav-item"><a class="nav-link" href="/tools/sdk">Overview</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-tool">dart</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-analyze">dart analyze</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-compile">dart compile</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-create">dart create</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-doc">dart doc</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-fix">dart fix</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-format">dart format</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-info">dart info</a></li><li class="nav-item"><a class="nav-link" href="/tools/pub/cmd">dart pub</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-run">dart run</a></li><li class="nav-item"><a class="nav-link" href="/tools/dart-test">dart test</a></li><li class="nav-item"><a class="nav-link" href="/tools/dartaotruntime">dartaotruntime</a></li><li class="nav-item"><a class="nav-link" href="/tools/experiment-flags">Experiment flags</a></li></ul></li><li class="nav-item"><a class="nav-link collapsible" data-toggle="collapse" data-target="#sidenav-7-3-2" href="#sidenav-7-3-2" role="button" aria-expanded="true" aria-controls="sidenav-7-3-2">Other command-line tools</a><ul class="nav flex-column flex-nowrap collapse show" id="sidenav-7-3-2"><li class="nav-item"><a class="nav-link" href="/tools/build_runner">build_runner</a></li><li class="nav-item"><a class="nav-link" href="/tools/webdev">webdev</a></li></ul></li></ul></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-7-4" href="#sidenav-7-4" role="button" aria-expanded="false" aria-controls="sidenav-7-4">Static analysis</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-7-4"><li class="nav-item"><a class="nav-link" href="/tools/analysis">Customizing static analysis</a></li><li class="nav-item"><a class="nav-link" href="/guides/language/sound-problems">Fixing common type problems</a></li><li class="nav-item"><a class="nav-link" href="/tools/non-promotion-reasons">Fixing type promotion failures</a></li><li class="nav-item"><a class="nav-link" href="/tools/linter-rules">Linter rules</a></li><li class="nav-item"><a class="nav-link" href="/tools/diagnostic-messages">Diagnostic messages</a></li></ul></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-7-5" href="#sidenav-7-5" role="button" aria-expanded="false" aria-controls="sidenav-7-5">Testing & optimization</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-7-5"><li class="nav-item"><a class="nav-link" href="/guides/testing">Testing</a></li><li class="nav-item"><a class="nav-link" href="/web/debugging">Debugging web apps</a></li></ul></li></ul></li><li aria-hidden="true"><div class="sidebar-primary-divider"></div></li><li class="nav-item"><a class="nav-link active collapsible" data-toggle="collapse" href="#sidenav-9" role="button" aria-expanded="true" aria-controls="sidenav-9">Resources</a><ul class="nav flex-column flex-nowrap collapse show" id="sidenav-9"><li class="nav-item"><a class="nav-link" href="/resources/dart-cheatsheet">Language cheatsheet</a></li><li class="nav-item"><a class="nav-link" href="/resources/breaking-changes">Breaking changes</a></li><li class="nav-item"><a class="nav-link" href="/guides/language/evolution">Language evolution</a></li><li class="nav-item"><a class="nav-link" href="/guides/language/spec">Language specification</a></li><li class="nav-item"><a class="nav-link" href="/resources/dart-3-migration">Dart 3 migration guide</a></li><li class="nav-item"><a class="nav-link collapsible collapsed" data-toggle="collapse" data-target="#sidenav-9-6" href="#sidenav-9-6" role="button" aria-expanded="false" aria-controls="sidenav-9-6">Coming from ...</a><ul class="nav flex-column flex-nowrap collapse" id="sidenav-9-6"><li class="nav-item"><a class="nav-link" href="/resources/coming-from/js-to-dart">JavaScript to Dart</a></li><li class="nav-item"><a class="nav-link" href="/resources/coming-from/swift-to-dart">Swift to Dart</a></li></ul></li><div class="dropdown-divider"></div><li class="nav-item"><a class="nav-link active" href="/resources/faq">FAQ</a></li><li class="nav-item"><a class="nav-link" href="/resources/glossary">Glossary</a></li><li class="nav-item"><a class="nav-link" href="/resources/books">Books</a></li><li class="nav-item"><a class="nav-link" href="/resources/videos">Videos</a></li><li class="nav-item"><a class="nav-link" href="/tutorials">Tutorials</a></li></ul></li><li class="nav-item"><a class="nav-link collapsible" data-toggle="collapse" href="#sidenav-10" role="button" aria-expanded="true" aria-controls="sidenav-10">Related sites</a><ul class="nav flex-column flex-nowrap collapse show" id="sidenav-10"><li class="nav-item"><a class="nav-link" href="https://api.dart.dev" target="_blank" rel="noopener">API reference</a></li><li class="nav-item"><a class="nav-link" href="https://medium.com/dartlang" target="_blank" rel="noopener">Blog</a></li><li class="nav-item"><a class="nav-link" href="https://dartpad.dev" target="_blank" rel="noopener">DartPad (online editor)</a></li><li class="nav-item"><a class="nav-link" href="https://flutter.dev" target="_blank" rel="noopener">Flutter</a></li><li class="nav-item"><a class="nav-link" href="https://pub.dev" target="_blank" rel="noopener">Package site</a></li></ul></li></ul></div></div><main id="page-content"><div id="site-toc--side" class="site-toc"><header class="site-toc__title">Contents</header><ul class="section-nav"><li class="toc-entry nav-item"><a class="nav-link" href="#general">General</a><ul class="nav"><li class="toc-entry nav-item"><a class="nav-link" href="#q-is-there-a-specification-for-dart">Q. Is there a specification for Dart?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-how-are-you-taking-input-on-changes-to-dart">Q. How are you taking input on changes to Dart?</a></li></ul></li><li class="toc-entry nav-item"><a class="nav-link" href="#language">Language</a><ul class="nav"><li class="toc-entry nav-item"><a class="nav-link" href="#q-isnt-dart-a-lot-like-java">Q. Isn't Dart a lot like Java?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-how-does-dart-relate-to-go">Q. How does Dart relate to Go?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-why-isnt-dart-more-like-haskell-smalltalk-python-scala-other-language">Q. Why isn't Dart more like Haskell / Smalltalk / Python / Scala / other language?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-why-isnt-dart-syntax-more-exciting">Q. Why isn't Dart syntax more exciting?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-does-dart-have-reflection-capabilities">Q. Does Dart have reflection capabilities?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-can-dart-add-tuples-partial-evaluation">Q. Can Dart add tuples, partial evaluation, ...?</a></li></ul></li><li class="toc-entry nav-item"><a class="nav-link" href="#typing">Typing</a><ul class="nav"><li class="toc-entry nav-item"><a class="nav-link" href="#q-does-dart-use-static-typing">Q. Does Dart use static typing?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-why-are-generics-covariant">Q. Why are generics covariant?</a></li></ul></li><li class="toc-entry nav-item"><a class="nav-link" href="#usage-and-tools">Usage and tools</a><ul class="nav"><li class="toc-entry nav-item"><a class="nav-link" href="#q-does-dart-support-json">Q. Does Dart support JSON?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-can-dart-run-on-the-server">Q. Can Dart run on the server?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-how-do-i-use-third-party-code-or-share-code">Q. How do I use third party code, or share code?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-do-i-need-to-use-a-particular-editor-or-ide-to-write-dart-code">Q. Do I need to use a particular editor or IDE to write Dart code?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-can-i-build-an-android-app-with-dart">Q. Can I build an Android app with Dart?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-what-are-some-real-world-production-deployments-of-dart">Q. What are some real-world production deployments of Dart?</a></li></ul></li><li class="toc-entry nav-item"><a class="nav-link" href="#native-execution">Native execution</a><ul class="nav"><li class="toc-entry nav-item"><a class="nav-link" href="#q-is-dart-single-threaded">Q. Is Dart single-threaded?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-can-i-compile-dart-code-to-native-code">Q. Can I compile Dart code to native code?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-can-i-compile-a-dart-program-for-running-in-a-terminal">Q. Can I compile a Dart program for running in a terminal?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-which-is-faster-aot-or-jit-compiled-code">Q. Which is faster: AOT- or JIT-compiled code?</a></li></ul></li><li class="toc-entry nav-item"><a class="nav-link" href="#web-execution">Web execution</a><ul class="nav"><li class="toc-entry nav-item"><a class="nav-link" href="#q-what-browsers-do-you-support-as-javascript-compilation-targets">Q. What browsers do you support as JavaScript compilation targets?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-is-dart-single-threaded-on-the-web">Q. Is Dart single-threaded on the web?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-will-any-valid-dart-code-compile-to-javascript">Q. Will any valid Dart code compile to JavaScript?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-why-does-dart-have-two-ways-to-compile-to-javascript">Q. Why does Dart have two ways to compile to JavaScript?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-how-are-floating-point-numbers-handled-when-compiled-to-javascript">Q. How are floating point numbers handled when compiled to JavaScript?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-how-does-dart-handle-integers-when-compiling-to-javascript">Q. How does Dart handle integers when compiling to JavaScript?</a></li><li class="toc-entry nav-item"><a class="nav-link" href="#q-how-are-typed-lists-handled-when-compiled-to-javascript">Q. How are typed lists handled when compiled to JavaScript?</a></li></ul></li></ul></div><article><div class="content"><div id="site-content-title"><h1>Dart FAQ</h1></div><div id="site-toc--inline" class="site-toc toc-collapsible toc-collapsed"><header class="site-toc__title">Contents <span class="site-toc--inline__toggle toc-toggle-down"><i class="material-symbols">keyboard_arrow_down</i></span> <span class="site-toc--inline__toggle toc-toggle-up"><i class="material-symbols">keyboard_arrow_up</i></span></header><ul class="section-nav"><li class="toc-entry"><a href="#general">General</a><ul><li class="toc-entry"><a href="#q-is-there-a-specification-for-dart">Q. Is there a specification for Dart?</a></li><li class="toc-entry"><a href="#q-how-are-you-taking-input-on-changes-to-dart">Q. How are you taking input on changes to Dart?</a></li></ul></li><li class="toc-entry"><a href="#language">Language</a><ul><li class="toc-entry"><a href="#q-isnt-dart-a-lot-like-java">Q. Isn't Dart a lot like Java?</a></li><li class="toc-entry"><a href="#q-how-does-dart-relate-to-go">Q. How does Dart relate to Go?</a></li><li class="toc-entry"><a href="#q-why-isnt-dart-more-like-haskell-smalltalk-python-scala-other-language">Q. Why isn't Dart more like Haskell / Smalltalk / Python / Scala / other language?</a></li><li class="toc-entry"><a href="#q-why-isnt-dart-syntax-more-exciting">Q. Why isn't Dart syntax more exciting?</a></li><li class="toc-entry"><a href="#q-does-dart-have-reflection-capabilities">Q. Does Dart have reflection capabilities?</a></li><li class="toc-entry"><a href="#q-can-dart-add-tuples-partial-evaluation">Q. Can Dart add tuples, partial evaluation, ...?</a></li></ul></li><li class="toc-entry"><a href="#typing">Typing</a><ul><li class="toc-entry"><a href="#q-does-dart-use-static-typing">Q. Does Dart use static typing?</a></li><li class="toc-entry"><a href="#q-why-are-generics-covariant">Q. Why are generics covariant?</a></li></ul></li><li class="toc-entry"><a href="#usage-and-tools">Usage and tools</a><ul><li class="toc-entry"><a href="#q-does-dart-support-json">Q. Does Dart support JSON?</a></li><li class="toc-entry"><a href="#q-can-dart-run-on-the-server">Q. Can Dart run on the server?</a></li><li class="toc-entry"><a href="#q-how-do-i-use-third-party-code-or-share-code">Q. How do I use third party code, or share code?</a></li><li class="toc-entry"><a href="#q-do-i-need-to-use-a-particular-editor-or-ide-to-write-dart-code">Q. Do I need to use a particular editor or IDE to write Dart code?</a></li><li class="toc-entry"><a href="#q-can-i-build-an-android-app-with-dart">Q. Can I build an Android app with Dart?</a></li><li class="toc-entry"><a href="#q-what-are-some-real-world-production-deployments-of-dart">Q. What are some real-world production deployments of Dart?</a></li></ul></li><li class="toc-entry"><a href="#native-execution">Native execution</a><ul><li class="toc-entry"><a href="#q-is-dart-single-threaded">Q. Is Dart single-threaded?</a></li><li class="toc-entry"><a href="#q-can-i-compile-dart-code-to-native-code">Q. Can I compile Dart code to native code?</a></li><li class="toc-entry"><a href="#q-can-i-compile-a-dart-program-for-running-in-a-terminal">Q. Can I compile a Dart program for running in a terminal?</a></li><li class="toc-entry"><a href="#q-which-is-faster-aot-or-jit-compiled-code">Q. Which is faster: AOT- or JIT-compiled code?</a></li></ul></li><li class="toc-entry"><a href="#web-execution">Web execution</a><ul><li class="toc-entry"><a href="#q-what-browsers-do-you-support-as-javascript-compilation-targets">Q. What browsers do you support as JavaScript compilation targets?</a></li><li class="toc-entry"><a href="#q-is-dart-single-threaded-on-the-web">Q. Is Dart single-threaded on the web?</a></li><li class="toc-entry"><a href="#q-will-any-valid-dart-code-compile-to-javascript">Q. Will any valid Dart code compile to JavaScript?</a></li><li class="toc-entry"><a href="#q-why-does-dart-have-two-ways-to-compile-to-javascript">Q. Why does Dart have two ways to compile to JavaScript?</a></li><li class="toc-entry"><a href="#q-how-are-floating-point-numbers-handled-when-compiled-to-javascript">Q. How are floating point numbers handled when compiled to JavaScript?</a></li><li class="toc-entry"><a href="#q-how-does-dart-handle-integers-when-compiling-to-javascript">Q. How does Dart handle integers when compiling to JavaScript?</a></li><li class="toc-entry"><a href="#q-how-are-typed-lists-handled-when-compiled-to-javascript">Q. How are typed lists handled when compiled to JavaScript?</a></li></ul></li></ul><span class="site-toc--inline__toggle toc-toggle-more-items"><i class="material-symbols">more_horiz</i></span></div><p>This page collects some of the top questions from the community.</p><div class="header-wrapper"><h2 id="general">General</h2><a class="heading-link" href="#general" aria-label="Link to 'General' section">#</a></div><div class="header-wrapper"><h3 id="q-is-there-a-specification-for-dart">Q. Is there a specification for Dart?</h3><a class="heading-link" href="#q-is-there-a-specification-for-dart" aria-label="Link to 'Q. Is there a specification for Dart?' section">#</a></div><p>Yes. <a href="https://ecma-international.org/publications-and-standards/standards/ecma-408/">EMCA-408</a> covers the Dart Programming Language Specification.</p><p>Five versions have been published. The latest in-progress version covers to Dart 2.13-dev.</p><div class="table-wrapper"><table class="table table-striped"><thead><tr><th>Edition</th><th>Published</th><th>Approved</th><th>Covers to version</th></tr></thead><tbody><tr><td><a href="https://spec.dart.dev/DartLangSpecDraft.pdf">6th</a> <i style="vertical-align: text-top" class="material-symbols">picture_as_pdf</i></td><td>January 24, 2024</td><td></td><td>2.13-dev</td></tr><tr><td><a href="/guides/language/specifications/DartLangSpec-v2.10.pdf">5th</a> <i style="vertical-align: text-top" class="material-symbols">picture_as_pdf</i></td><td>April 9, 2021</td><td></td><td>2.10</td></tr><tr><td><a href="https://ecma-international.org/wp-content/uploads/ECMA-408_4th_edition_december_2015.pdf">4th</a> <i style="vertical-align: text-top" class="material-symbols">picture_as_pdf</i></td><td>August 19, 2015</td><td>December 2015</td><td>1.11</td></tr><tr><td><a href="https://ecma-international.org/wp-content/uploads/ECMA-408_3rd_edition_june_2015.pdf">3rd</a> <i style="vertical-align: text-top" class="material-symbols">picture_as_pdf</i></td><td>April 15, 2015</td><td>June 2015</td><td>1.9</td></tr><tr><td><a href="https://ecma-international.org/wp-content/uploads/ECMA-408_2nd_edition_december_2014.pdf">2nd</a> <i style="vertical-align: text-top" class="material-symbols">picture_as_pdf</i></td><td>November 21, 2014</td><td>December 2014</td><td>1.6</td></tr><tr><td><a href="https://ecma-international.org/wp-content/uploads/ECMA-408_1st_edition_june_2014.pdf">1st</a> <i style="vertical-align: text-top" class="material-symbols">picture_as_pdf</i></td><td>March 27, 2014</td><td>June 2014</td><td>1.3</td></tr></tbody></table></div><p>To learn more about the specification, review the <a href="/guides/language/spec">Dart language specification</a> page.</p><div class="header-wrapper"><h3 id="q-how-are-you-taking-input-on-changes-to-dart">Q. How are you taking input on changes to Dart?</h3><a class="heading-link" href="#q-how-are-you-taking-input-on-changes-to-dart" aria-label="Link to 'Q. How are you taking input on changes to Dart?' section">#</a></div><p>The team listens to feedback, reads <a href="https://github.com/dart-lang/sdk/issues">issues</a>, and reviews patches from contributors. A contributor with a good track record can be granted write permission to the repository. Google engineers also work in the public repository, making visible changes. The project has received many external patches and welcomes distributed committers.</p><hr><div class="header-wrapper"><h2 id="language">Language</h2><a class="heading-link" href="#language" aria-label="Link to 'Language' section">#</a></div><div class="header-wrapper"><h3 id="q-isnt-dart-a-lot-like-java">Q. Isn't Dart a lot like Java?</h3><a class="heading-link" href="#q-isnt-dart-a-lot-like-java" aria-label="Link to 'Q. Isn't Dart a lot like Java?' section">#</a></div><p>Dart has some similarities with Java. To review brief examples with familiar syntax, reviewed the code samples in the <a href="/language">Introduction to Dart</a>.</p><div class="header-wrapper"><h3 id="q-how-does-dart-relate-to-go">Q. How does Dart relate to Go?</h3><a class="heading-link" href="#q-how-does-dart-relate-to-go" aria-label="Link to 'Q. How does Dart relate to Go?' section">#</a></div><p>Google started the Dart and Go language projects. These independent projects have different goals. As a result, they make different choices. The languages have very different natures, but team members learn from each others' work.</p><div class="header-wrapper"><h3 id="q-why-isnt-dart-more-like-haskell-smalltalk-python-scala-other-language">Q. Why isn't Dart more like Haskell / Smalltalk / Python / Scala / other language?</h3><a class="heading-link" href="#q-why-isnt-dart-more-like-haskell-smalltalk-python-scala-other-language" aria-label="Link to 'Q. Why isn't Dart more like Haskell / Smalltalk / Python / Scala / other language?' section">#</a></div><p>Various reasons that depend on the comparison language.</p><dl><dt><strong>Languages differ from JavaScript</strong></dt><dd>Dart must compile to efficient JavaScript. Source languages that differ too much from JavaScript can generate complex output code to emulate the source language's behavior. This can cause performance to vary in non-obvious ways to the programmer.</dd><dt><strong>Languages that compile to native code</strong></dt><dd>Dart prioritizes efficient compilation to machine code. Therefore, it shares some aspects with other compiled languages.</dd><dt><strong>Languages that are considered &quot;more dynamic&quot; than Dart</strong></dt><dd>Dart chooses to trade off some of this arbitrary runtime modification to achieve better performance and more productive tools.</dd></dl><div class="header-wrapper"><h3 id="q-why-isnt-dart-syntax-more-exciting">Q. Why isn't Dart syntax more exciting?</h3><a class="heading-link" href="#q-why-isnt-dart-syntax-more-exciting" aria-label="Link to 'Q. Why isn't Dart syntax more exciting?' section">#</a></div><p>Some nice syntactic features exist, like the <code>this.</code> constructor args and <code>=&gt;</code> for one-line functions. Dart chooses <em>familiarity</em> over <em>excitement</em>.</p><div class="header-wrapper"><h3 id="q-does-dart-have-reflection-capabilities">Q. Does Dart have reflection capabilities?</h3><a class="heading-link" href="#q-does-dart-have-reflection-capabilities" aria-label="Link to 'Q. Does Dart have reflection capabilities?' section">#</a></div><dl><dt><strong>Servers and command-line scripts</strong></dt><dd>Yes, Dart supports reflection from the <a href="https://api.dart.dev/dart-mirrors">mirrors API</a>.</dd><dt><strong>Web or Flutter apps</strong></dt><dd>No, Dart doesn't support write to <a href="https://docs.flutter.dev/resources/faq#does-flutter-come-with-a-reflection--mirrors-system">web or Flutter apps</a>.</dd></dl><div class="header-wrapper"><h3 id="q-can-dart-add-tuples-partial-evaluation">Q. Can Dart add tuples, partial evaluation, ...?</h3><a class="heading-link" href="#q-can-dart-add-tuples-partial-evaluation" aria-label="Link to 'Q. Can Dart add tuples, partial evaluation, ...?' section">#</a></div><p>Future releases might include a feature you want. Some features don't fit the nature of the language. Some don't play well with other features. Simplicity is the most important gift to give to future programmers.</p><p>To check if someone has filed your request, review the <a href="https://github.com/dart-lang/language/projects/1">language funnel</a> and <a href="https://github.com/dart-lang/language/issues">language issues list</a>.</p><ul><li><p>If an issue exists, add your thumbs up.</p></li><li><p>If an issue doesn't exist, request a <a href="https://github.com/dart-lang/site-www/issues/new/choose">new issue</a>.</p><p>Make a thoughtful argument for your feature. Add evidence to your argument. Include sample code with and without your feature or a sizeable codebase.</p></li></ul><p>To learn more, consult the <a href="https://github.com/dart-lang/language/blob/main/doc/life_of_a_language_feature.md">language evolution process</a>.</p><p>Don't be surprised if the Dart language team turns down your request. Removing a language feature inflicts more pain than adding one. The Dart language team adds the most obvious features first, and revisits the next tier later.</p><p>The community will request more features than any single language can meet without making a total hash of it. The Dart language team does appreciate suggestions and evidence. This appreciation should become apparent through careful design choices and fair communication about them.</p><hr><div class="header-wrapper"><h2 id="typing">Typing</h2><a class="heading-link" href="#typing" aria-label="Link to 'Typing' section">#</a></div><div class="header-wrapper"><h3 id="q-does-dart-use-static-typing">Q. Does Dart use static typing?</h3><a class="heading-link" href="#q-does-dart-use-static-typing" aria-label="Link to 'Q. Does Dart use static typing?' section">#</a></div><p>Yes, Dart uses static typing. To learn more, consult <a href="/language/type-system">Dart's type system</a>.</p><p>Combining static and runtime checks, Dart has a sound type system. This guarantees that an expression of one type cannot produce a value of another type.</p><p>if you need the flexibility of a dynamic typing, you can annotate any variable with <code>dynamic</code>. This <code>dynamic</code> type is static, but can contain any type at <em>runtime</em>. That removes many benefits of a type-safe language from that variable.</p><div class="header-wrapper"><h3 id="q-why-are-generics-covariant">Q. Why are generics covariant?</h3><a class="heading-link" href="#q-why-are-generics-covariant" aria-label="Link to 'Q. Why are generics covariant?' section">#</a></div><p>Covariant generics fit a common intuition that programmers have, and very often this intuition is correct, such as in the common &quot;read-only&quot; use of a generic. Although this intuition isn't always correct, Dart is erring on the side of convenience by having covariant generics.</p><p>The only other reasonable default variance would be invariance. While having only invariant generics would definitely prevent more errors, it would also prevent a lot of valid programs or require conversion every time you have a list of &quot;apples&quot;, and someone just wants &quot;fruits&quot;.</p><p>We are familiar with a variety of ways that languages try to mark or infer variance. We feel that variance inference systems add too much complexity for their benefit in Dart.</p><p>Again, we're trying to be pragmatic, and we think the outcome is reasonable.</p><hr><div class="header-wrapper"><h2 id="usage-and-tools">Usage and tools</h2><a class="heading-link" href="#usage-and-tools" aria-label="Link to 'Usage and tools' section">#</a></div><div class="header-wrapper"><h3 id="q-does-dart-support-json">Q. Does Dart support JSON?</h3><a class="heading-link" href="#q-does-dart-support-json" aria-label="Link to 'Q. Does Dart support JSON?' section">#</a></div><p>Yes. To learn more, consult the <a href="https://api.dart.dev/dart-convert/JsonCodec-class.html">JSON</a> converters in the <a href="https://api.dart.dev/stable/dart-convert/dart-convert-library.html">dart:convert</a> library.</p><div class="header-wrapper"><h3 id="q-can-dart-run-on-the-server">Q. Can Dart run on the server?</h3><a class="heading-link" href="#q-can-dart-run-on-the-server" aria-label="Link to 'Q. Can Dart run on the server?' section">#</a></div><p>Yes. To learn more, consult <a href="/server">Dart on the Server</a>.</p><div class="header-wrapper"><h3 id="q-how-do-i-use-third-party-code-or-share-code">Q. How do I use third party code, or share code?</h3><a class="heading-link" href="#q-how-do-i-use-third-party-code-or-share-code" aria-label="Link to 'Q. How do I use third party code, or share code?' section">#</a></div><p>Search for packages on the <a href="https://pub.dev">pub.dev site</a>, the package-hosting service for Dart and Flutter. Use the <a href="/tools/pub/cmd"><code>pub</code> command</a> to package your code and upload to the site.</p><div class="header-wrapper"><h3 id="q-do-i-need-to-use-a-particular-editor-or-ide-to-write-dart-code">Q. Do I need to use a particular editor or IDE to write Dart code?</h3><a class="heading-link" href="#q-do-i-need-to-use-a-particular-editor-or-ide-to-write-dart-code" aria-label="Link to 'Q. Do I need to use a particular editor or IDE to write Dart code?' section">#</a></div><p>No. You can try out Dart code with <a href="https://dartpad.dev">DartPad,</a> and then use your favorite editor or IDE for development. Some full-featured IDEs such as IntelliJ IDEA, WebStorm, and Visual Studio Code have Dart plugins. Open source Dart plugins also exist for a number of editors. For more information, see the <a href="/tools/">Dart tools</a>.</p><div class="header-wrapper"><h3 id="q-can-i-build-an-android-app-with-dart">Q. Can I build an Android app with Dart?</h3><a class="heading-link" href="#q-can-i-build-an-android-app-with-dart" aria-label="Link to 'Q. Can I build an Android app with Dart?' section">#</a></div><p>Yes! You can build an Android app using the <a href="https://flutter.dev">Flutter</a> framework and the Dart language. Any Flutter app you write will also work on iOS, the web, and desktop platforms.</p><div class="header-wrapper"><h3 id="q-what-are-some-real-world-production-deployments-of-dart">Q. What are some real-world production deployments of Dart?</h3><a class="heading-link" href="#q-what-are-some-real-world-production-deployments-of-dart" aria-label="Link to 'Q. What are some real-world production deployments of Dart?' section">#</a></div><p>Google Ads, AdSense, AdMob, and the Google Assistant use Dart. A significant portion of Google's revenue flows through these apps. Inside or outside of Google, <a href="https://flutter.dev/showcase">every Flutter app</a> uses Dart.</p><hr><div class="header-wrapper"><h2 id="native-execution">Native execution</h2><a class="heading-link" href="#native-execution" aria-label="Link to 'Native execution' section">#</a></div><div class="header-wrapper"><h3 id="q-is-dart-single-threaded">Q. Is Dart single-threaded?</h3><a class="heading-link" href="#q-is-dart-single-threaded" aria-label="Link to 'Q. Is Dart single-threaded?' section">#</a></div><p>No. On native targets, <a href="https://api.dart.dev/stable/dart-isolate/dart-isolate-library.html">Dart's isolate API</a> can start multiple execution threads when needed. The Dart VM uses multiple CPU cores to run those threads at the same time.</p><p><a href="/language/concurrency">Dart's concurrency architecture</a> abstracts the complex, error-prone code of typical shared-memory threading. This might explain the misconception that Dart is single-threaded.</p><p>Concurrency works differently in Dart web apps. To learn more, consult <a href="#q-is-dart-single-threaded-on-the-web">Is Dart single-threaded on the web?</a></p><div class="header-wrapper"><h3 id="q-can-i-compile-dart-code-to-native-code">Q. Can I compile Dart code to native code?</h3><a class="heading-link" href="#q-can-i-compile-dart-code-to-native-code" aria-label="Link to 'Q. Can I compile Dart code to native code?' section">#</a></div><p>Yes. When compiling apps that target devices like desktops or mobile, <a href="/overview#native-platform">Dart Native</a> includes both a Dart VM with a just-in-time (JIT) compiler and an ahead-of-time (AOT) compiler to produce native code.</p><p>The <a href="https://flutter.dev">Flutter</a> framework uses Dart's native compilation capability to produce fast native apps.</p><div class="header-wrapper"><h3 id="q-can-i-compile-a-dart-program-for-running-in-a-terminal">Q. Can I compile a Dart program for running in a terminal?</h3><a class="heading-link" href="#q-can-i-compile-a-dart-program-for-running-in-a-terminal" aria-label="Link to 'Q. Can I compile a Dart program for running in a terminal?' section">#</a></div><p>Yes. Dart programs can be compiled to native code for running in a macOS Terminal, Windows command prompt, or a Linux shell.</p><p>Consult the <a href="/tools/dart-compile">dart compile</a> documentation.</p><div class="header-wrapper"><h3 id="q-which-is-faster-aot-or-jit-compiled-code">Q. Which is faster: AOT- or JIT-compiled code?</h3><a class="heading-link" href="#q-which-is-faster-aot-or-jit-compiled-code" aria-label="Link to 'Q. Which is faster: AOT- or JIT-compiled code?' section">#</a></div><p>It depends. How Dart compiles code produces apps with different performance characteristics.</p><ul><li><p>AOT-compiled code starts fast with consistent runtime performance, with no latency during early runs.</p></li><li><p>JIT-compiled code starts slower, but reaches peak performance after it runs long enough to apply runtime optimizations.</p></li></ul><hr><div class="header-wrapper"><h2 id="web-execution">Web execution</h2><a class="heading-link" href="#web-execution" aria-label="Link to 'Web execution' section">#</a></div><div class="header-wrapper"><h3 id="q-what-browsers-do-you-support-as-javascript-compilation-targets">Q. What browsers do you support as JavaScript compilation targets?</h3><a class="heading-link" href="#q-what-browsers-do-you-support-as-javascript-compilation-targets" aria-label="Link to 'Q. What browsers do you support as JavaScript compilation targets?' section">#</a></div><p>The <em>production</em> web compiler supports the last two major releases of the following browsers:</p><ul><li>Google Chrome</li><li>Microsoft Edge</li><li>Firefox</li><li>Apple Safari</li></ul><p>The <a href="/tools/webdev#serve"><em>development</em> JavaScript compiler</a> only supports Chrome for debugging.</p><div class="header-wrapper"><h3 id="q-is-dart-single-threaded-on-the-web">Q. Is Dart single-threaded on the web?</h3><a class="heading-link" href="#q-is-dart-single-threaded-on-the-web" aria-label="Link to 'Q. Is Dart single-threaded on the web?' section">#</a></div><p>Somewhat. Dart web apps can't use isolates. To achieve code concurrency, web apps use <a href="https://developer.mozilla.org/docs/Web/API/Web_Workers_API/Using_web_workers">web workers</a>. Web workers lack the ease and efficiency of isolates, and have different capabilities and restrictions. To learn more, consult <a href="/language/concurrency#concurrency-on-the-web">Concurrency on the web</a>.</p><div class="header-wrapper"><h3 id="q-will-any-valid-dart-code-compile-to-javascript">Q. Will any valid Dart code compile to JavaScript?</h3><a class="heading-link" href="#q-will-any-valid-dart-code-compile-to-javascript" aria-label="Link to 'Q. Will any valid Dart code compile to JavaScript?' section">#</a></div><p>Any valid Dart code should compile to JavaScript. Some libraries run only on the server or in Flutter. Consider the <code>dart:io</code> library. It provides access to operating system files and directories with APIs not available to the browser.</p><div class="header-wrapper"><h3 id="q-why-does-dart-have-two-ways-to-compile-to-javascript">Q. Why does Dart have two ways to compile to JavaScript?</h3><a class="heading-link" href="#q-why-does-dart-have-two-ways-to-compile-to-javascript" aria-label="Link to 'Q. Why does Dart have two ways to compile to JavaScript?' section">#</a></div><p>Both ways use the <code>webdev</code> command. The <code>webdev build</code> command produces minified JavaScript optimized for production. The <code>webdev serve</code> command produces modularized JavaScript optimized for debugging.</p><p>To learn more, consult the <a href="/tools/dart-compile#js">Dart JavaScript compiler reference</a></p><div class="header-wrapper"><h3 id="q-how-are-floating-point-numbers-handled-when-compiled-to-javascript">Q. How are floating point numbers handled when compiled to JavaScript?</h3><a class="heading-link" href="#q-how-are-floating-point-numbers-handled-when-compiled-to-javascript" aria-label="Link to 'Q. How are floating point numbers handled when compiled to JavaScript?' section">#</a></div><p>JavaScript has only one number representation: an IEEE-754 double-precision floating-point number. This means that any number鈥攊nteger or floating point鈥攊s represented as a double. JavaScript has typed data arrays, and the mapping from native Dart typed lists to JavaScript typed arrays is trivial.</p><div class="header-wrapper"><h3 id="q-how-does-dart-handle-integers-when-compiling-to-javascript">Q. How does Dart handle integers when compiling to JavaScript?</h3><a class="heading-link" href="#q-how-does-dart-handle-integers-when-compiling-to-javascript" aria-label="Link to 'Q. How does Dart handle integers when compiling to JavaScript?' section">#</a></div><p>JavaScript stores all <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type">numbers as doubles</a>. This limits integers to 53-bit precision with values ranging from -2<sup>53</sup> to 2<sup>53</sup> JavaScript can store integers in this range without loss of accuracy. As JavaScript VMs manipulates the internal representation of numbers, stay within the small integer (SMI) range. In JavaScript, that range falls between -2<sup>31</sup> to 2<sup>31</sup> (-2,147,483,647 to 2,147,483,648 including 0).</p><div class="header-wrapper"><h3 id="q-how-are-typed-lists-handled-when-compiled-to-javascript">Q. How are typed lists handled when compiled to JavaScript?</h3><a class="heading-link" href="#q-how-are-typed-lists-handled-when-compiled-to-javascript" aria-label="Link to 'Q. How are typed lists handled when compiled to JavaScript?' section">#</a></div><p>JavaScript offers 32-bit typed arrays compatible with Dart's typed lists. This maps as <code>Float32List</code> becoming a <code>Float32Array</code>. The production JavaScript compiler doesn't support 64-bit integers: <code>Int64List</code> or <code>Uint64List</code>. Compiling Dart code with either of those lists results in a runtime exception.</p><p id="page-github-links"><span>Unless stated otherwise, the documentation on this site reflects Dart 3.5.4. Page last updated on 2024-11-17.</span> <a href="https://github.com/dart-lang/site-www/tree/main/src/content/resources/faq.md" target="_blank" rel="noopener">View source</a> <span>or </span><a href="https://github.com/dart-lang/site-www/issues/new?template=1_page_issue.yml&page-url=https://dart.dev/resources/faq/&page-source=https://github.com/dart-lang/site-www/tree/main/src/content/resources/faq.md" title="Report an issue with this page" target="_blank" rel="noopener">report an issue</a>.</p></div></article></main><footer id="page-footer"><div class="footer-section footer-main"><a href="/" class="brand" title="Dart"><img src="/assets/img/logo/logo-white-text.svg" alt="Dart" width="164"></a><div class="footer-social-links"><a href="https://medium.com/dartlang" target="_blank" rel="noopener" title="Medium blog"><svg><use href="/assets/img/social/medium.svg#medium"></use></svg> </a><a href="https://github.com/dart-lang" target="_blank" rel="noopener" title="GitHub"><svg><use href="/assets/img/social/github.svg#github"></use></svg> </a><a href="https://twitter.com/dart_lang" target="_blank" rel="noopener" title="X (Twitter)"><svg><use href="/assets/img/social/x.svg#x"></use></svg></a></div></div><div class="footer-section footer-tray"><div class="footer-licenses">Except as otherwise noted, this site is licensed under a <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>, and code samples are licensed under the <a href="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</a>.</div><div class="footer-utility-links"><ul><li><a href="/terms" title="Terms of use">Terms</a></li><li><a href="https://policies.google.com/privacy" target="_blank" rel="noopener" title="Privacy policy">Privacy</a></li><li><a href="/security" title="Security philosophy and practices">Security</a></li></ul></div></div></footer></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10