-
Notifications
You must be signed in to change notification settings - Fork 2
/
faq.html
1226 lines (1038 loc) · 67.6 KB
/
faq.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Language" content="en_US" />
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="You have questions about Dart, we have answers.">
<title>FAQ | Dart</title>
<!-- Favicon / Touch Icons -->
<link rel="icon" sizes="64x64" href="/assets/shared/dart/icon/64.png">
<link href="/assets/touch-icon-iphone-a46c306c4fbfae0b28d63f512b01d7cb2ccf1e4ca9d7f3aab15ba1170beed4a0.png" rel="apple-touch-icon">
<link href="/assets/touch-icon-ipad-d0181720760b3912858b6d40da1d5586b1e92c7c8656a485ea41005674401e6b.png" rel="apple-touch-icon" sizes="76x76">
<link href="/assets/touch-icon-iphone-retina-3d9821a631425376ac6203dea3c23c1940ab7b5c506a25406662fab76cee2e0b.png" rel="apple-touch-icon" sizes="120x120">
<link href="/assets/touch-icon-ipad-retina-b9715401952522f1daee2b4a4064a1bbfb5ffab78d0a47a7226dc87444d51c32.png" rel="apple-touch-icon" sizes="152x152">
<!-- Twitter Card -->
<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." />
<!-- Open Graph -->
<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="https://www.dartlang.org/faq.html" />
<meta property="og:image" content="https://www.dartlang.org/assets/shared/dart-logo-for-shares.png?2" />
<link href="https://fonts.googleapis.com/css?family=Google+Sans:300,400,500|Google+Sans+Display:400|Roboto:300,400,500|Roboto+Mono:300,400,700|Material+Icons" rel="stylesheet">
<link rel="stylesheet" type="text/css" integrity="sha256-S0f9nOqFuIcXJSRb1Y4WwIH+QKL9f54WrcUkklWPM4k=" crossorigin="anonymous" href="/assets/main-4b47fd9cea85b8871725245bd58e16c081fe40a2fd7f9e16adc52492558f3389.css">
<script src="/assets/main-f7f2f2125f3c379daf0f5ca0ecf142cd2e10b030af396a510324fddb1682c5e2.js" integrity="sha256-9/LyEl88N52vD1yg7PFCzS4QsDCvOWpRAyT92xaCxeI=" crossorigin="anonymous" type="text/javascript"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-26406144-4', 'auto');
ga('send', 'pageview');
</script>
</head>
<body class="default show_banner">
<header id="page-header" class="site-header">
<nav id="mainnav" class="site-header">
<div id="menu-toggle"><i class="icon icon-menu"></i></div>
<a href="/" class="brand" title="Dart">
<img src="/assets/shared/dart/logo+text/horizontal/white-e71fb382ad5229792cc704b3ee7a88f8013e986d6e34f0956d89c453b454d0a5.svg" alt="Dart">
</a>
<ul class="navbar">
<li class="mainnav__get-started">
<a href="/guides" class="nav-link"><span>文档</span></a>
</li>
<li>
<a href="/platforms" class="nav-link">平台</a>
</li>
<li>
<a href="/community" class="nav-link">社区</a>
</li>
<li>
<a href="https://dartpad.cn/" target="_blank" class="nav-link no-automatic-external">体验 Dart</a>
</li>
<li>
<a href="/get-dart" class="nav-link">安装 Dart</a>
</li>
<li>
<a href="/about_zh_CN" class="nav-link">关于</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" type="search" name="q" id="q" autocomplete="off" placeholder="Search" aria-label="Search">
</form>
</li>
</ul>
</nav>
</header>
<div class="banner">
<p class="banner__text">
Dart 2.4.0 版本启动! 更多信息参见
<a class="external" href="https://github.com/dart-lang/sdk/blob/master/CHANGELOG.md#240---2019-06-27">更新日志</a>。
</p>
</div>
<div id="sidenav" class="">
<form action="/search/" class="site-header__search form-inline">
<input class="site-header__searchfield form-control" type="search" name="q" id="q" autocomplete="off" placeholder="Search" aria-label="Search">
</form>
<div class="site-sidebar">
<ul class="navbar-nav">
<li class="nav-item">
<a href="/platforms" class="nav-link">平台</a>
</li>
<li class="nav-item">
<a href="/community" class="nav-link">社区</a>
</li>
<li class="nav-item">
<a href="https://dartpad.cn" class="nav-link">体验 Dart</a>
</li>
<li class="nav-item">
<a href="/guides" class="nav-link">文档</a>
</li>
<li>
<a href="/about_zh_CN" class="nav-link">关于</a>
</li>
</ul>
<ul class="nav flex-column"><li class="nav-item">
<a class="nav-link collapsed" data-toggle="collapse" href="#sidenav-1" role="button"
aria-expanded="false" aria-controls="sidenav-1"
>示例 & 教程</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-1">
<li class="nav-item">
<a class="nav-link" href="/samples">示例程序</a>
</li><li class="nav-item">
<a class="nav-link collapsable"
data-toggle="collapse" data-target="#sidenav-1-2"
href="#sidenav-1-2" role="button"
aria-expanded="true" aria-controls="sidenav-1-2"
>Codelab
</a>
<ul class="nav flex-column flex-nowrap collapse show" id="sidenav-1-2">
<li class="nav-item">
<a class="nav-link" href="/codelabs">综述</a>
</li><li class="nav-item">
<a class="nav-link" href="/codelabs/dart-cheatsheet">Codelab 速查</a>
</li></ul>
</li>
<li class="nav-item">
<a class="nav-link" href="/tutorials">教程</a>
</li>
</ul>
</li><li class="nav-item">
<a class="nav-link collapsed" data-toggle="collapse" href="#sidenav-2" role="button"
aria-expanded="false" aria-controls="sidenav-2"
>语言</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-2">
<li class="nav-item">
<a class="nav-link" href="/guides/language/language-tour">概览</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/language/sound-dart">类型系统</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/language/spec">规范</a>
</li><li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-2-4"
href="#sidenav-2-4" role="button"
aria-expanded="false" aria-controls="sidenav-2-4"
>Effective Dart
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-2-4">
<li class="nav-item">
<a class="nav-link" href="/guides/language/effective-dart">综述</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/language/effective-dart/style">风格</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/language/effective-dart/documentation">文档</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/language/effective-dart/usage">使用</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/language/effective-dart/design">设计</a>
</li></ul>
</li>
</ul>
</li><li class="nav-item">
<a class="nav-link collapsed" data-toggle="collapse" href="#sidenav-3" role="button"
aria-expanded="false" aria-controls="sidenav-3"
>核心库</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-3">
<li class="nav-item">
<a class="nav-link" href="/guides/libraries">综述</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/libraries/library-tour">概览</a>
</li><li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-3-3"
href="#sidenav-3-3" role="button"
aria-expanded="false" aria-controls="sidenav-3-3"
>文章
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-3-3">
<li class="nav-item">
<a class="nav-link" href="/articles/libraries/dart-io">Intro to dart:io</a>
</li><li class="nav-item">
<a class="nav-link" href="/articles/libraries/creating-streams">Creating streams</a>
</li></ul>
</li>
</ul>
</li><li class="nav-item">
<a class="nav-link collapsed" data-toggle="collapse" href="#sidenav-4" role="button"
aria-expanded="false" aria-controls="sidenav-4"
>包</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-4">
<li class="nav-item">
<a class="nav-link" href="/guides/packages">如何使用包</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/libraries/useful-libraries">常用包</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/libraries/create-library-packages">创建包</a>
</li><li class="nav-item">
<a class="nav-link" href="/tools/pub/publishing">发布包</a>
</li><li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-4-5"
href="#sidenav-4-5" role="button"
aria-expanded="false" aria-controls="sidenav-4-5"
>引用包
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-4-5">
<li class="nav-item">
<a class="nav-link" href="/tools/pub/dependencies">依赖</a>
</li><li class="nav-item">
<a class="nav-link" href="/tools/pub/glossary">术语</a>
</li><li class="nav-item">
<a class="nav-link" href="/tools/pub/package-layout">包的设计约定</a>
</li><li class="nav-item">
<a class="nav-link" href="/tools/pub/environment-variables">Pub 环境变量</a>
</li><li class="nav-item">
<a class="nav-link" href="/tools/pub/pubspec">Pubspec 文件</a>
</li><li class="nav-item">
<a class="nav-link" href="/tools/pub/troubleshoot">Pub 问题分析与解决</a>
</li><li class="nav-item">
<a class="nav-link" href="/tools/pub/versioning">版本</a>
</li></ul>
</li>
</ul>
</li><li class="nav-item">
<a class="nav-link collapsed" data-toggle="collapse" href="#sidenav-5" role="button"
aria-expanded="false" aria-controls="sidenav-5"
>开发</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-5">
<li class="nav-item">
<a class="nav-link" href="/tutorials/language/futures">Futures & Async-Await</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/json">使用 JSON</a>
</li><li class="nav-item">
<a class="nav-link" href="/tutorials/language/streams">Stream</a>
</li><li class="nav-item">
<a class="nav-link" href="/mobile">移动应用</a>
</li><li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-5-5"
href="#sidenav-5-5" role="button"
aria-expanded="false" aria-controls="sidenav-5-5"
>命令行应用 & 服务应用
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-5-5">
<li class="nav-item">
<a class="nav-link" href="/server">综述</a>
</li><li class="nav-item">
<a class="nav-link" href="/tutorials/server/get-started">入门</a>
</li><li class="nav-item">
<a class="nav-link" href="/tutorials/server/cmdline">编写命令行应用</a>
</li><li class="nav-item">
<a class="nav-link" href="/tutorials/server/httpserver">编写 HTTP 客户端和服务端应用</a>
</li><li class="nav-item">
<a class="nav-link" href="/server/c-interop">C & C++ 交互</a>
</li><li class="nav-item">
<a class="nav-link" href="/server/libraries">库和包</a>
</li></ul>
</li>
<li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-5-6"
href="#sidenav-5-6" role="button"
aria-expanded="false" aria-controls="sidenav-5-6"
>Web 应用
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-5-6">
<li class="nav-item">
<a class="nav-link" href="/web">综述</a>
</li><li class="nav-item">
<a class="nav-link" href="/tutorials/web/get-started">入门</a>
</li><li class="nav-item">
<a class="nav-link" href="/tutorials/web/fetch-data">动态获取数据</a>
</li><li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-5-6-4"
href="#sidenav-5-6-4" role="button"
aria-expanded="false" aria-controls="sidenav-5-6-4"
>底层 Web 编程
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-5-6-4">
<li class="nav-item">
<a class="nav-link" href="/tutorials/web/low-level-html/connect-dart-html">Dart 和 HTML 关联</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tutorials/web/low-level-html/add-elements">在 DOM 中增加 Element</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tutorials/web/low-level-html/remove-elements">在 DOM 中移除 Element</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="/web/js-interop">JS/TS 交互</a>
</li><li class="nav-item">
<a class="nav-link" href="/web/deployment">开发</a>
</li><li class="nav-item">
<a class="nav-link" href="/web/libraries">库和包</a>
</li></ul>
</li>
</ul>
</li><li class="nav-item">
<a class="nav-link collapsed" data-toggle="collapse" href="#sidenav-6" role="button"
aria-expanded="false" aria-controls="sidenav-6"
>工具 & 技巧</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-6">
<li class="nav-item">
<a class="nav-link" href="/tools">综述</a>
</li><li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-6-2"
href="#sidenav-6-2" role="button"
aria-expanded="false" aria-controls="sidenav-6-2"
>编辑 & 调试
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-6-2">
<li class="nav-item">
<a class="nav-link" href="/tools/dart-devtools">Dart DevTool</a>
</li><li class="nav-item">
<a class="nav-link" href="/tools/dartpad">DartPad</a>
</li><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></ul>
</li>
<li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-6-3"
href="#sidenav-6-3" role="button"
aria-expanded="false" aria-controls="sidenav-6-3"
>命令行工具
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-6-3">
<li class="nav-item">
<a class="nav-link collapsable"
data-toggle="collapse" data-target="#sidenav-6-3-1"
href="#sidenav-6-3-1" role="button"
aria-expanded="true" aria-controls="sidenav-6-3-1"
>Dart SDK
</a>
<ul class="nav flex-column flex-nowrap collapse show" id="sidenav-6-3-1">
<li class="nav-item">
<a class="nav-link" href="/tools/sdk">综述</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tools/dart-vm">dart (Dart VM)</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tools/dart2aot">dart2aot & dartaotruntime</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tools/dart2js">dart2js (prod JS)</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tools/dartanalyzer">dartanalyzer</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tools/dartdevc">dartdevc (dev JS)</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tools/dartdoc">dartdoc</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tools/dartfmt">dartfmt</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tools/pub/cmd">pub</a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link collapsable"
data-toggle="collapse" data-target="#sidenav-6-3-2"
href="#sidenav-6-3-2" role="button"
aria-expanded="true" aria-controls="sidenav-6-3-2"
>其他命令行工具
</a>
<ul class="nav flex-column flex-nowrap collapse show" id="sidenav-6-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 collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-6-4"
href="#sidenav-6-4" role="button"
aria-expanded="false" aria-controls="sidenav-6-4"
>源码管理
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-6-4">
<li class="nav-item">
<a class="nav-link" href="/guides/language/formatting">格式化代码</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/libraries/private-files">哪些内容不应该被提交</a>
</li></ul>
</li>
<li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-6-5"
href="#sidenav-6-5" role="button"
aria-expanded="false" aria-controls="sidenav-6-5"
>静态分析
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-6-5">
<li class="nav-item">
<a class="nav-link" href="/guides/language/analysis-options">Customizing static analysis</a>
</li><li class="nav-item">
<a class="nav-link" href="/guides/language/sound-problems">Fixing common type problems</a>
</li></ul>
</li>
<li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-6-6"
href="#sidenav-6-6" role="button"
aria-expanded="false" aria-controls="sidenav-6-6"
>测试 & 优化
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-6-6">
<li class="nav-item">
<a class="nav-link" href="/guides/testing">测试</a>
</li><li class="nav-item">
<a class="nav-link" href="/web/debugging">调试 Web 应用</a>
</li></ul>
</li>
</ul>
</li><li class="nav-item">
<a class="nav-link active" data-toggle="collapse" href="#sidenav-7" role="button"
aria-expanded="true" aria-controls="sidenav-7"
>资源</a>
<ul class="nav flex-column flex-nowrap collapse show" id="sidenav-7">
<li class="nav-item">
<a class="nav-link" href="/code-of-conduct">行为守则</a>
</li><li class="nav-item">
<a class="nav-link active" href="/faq">FAQ</a>
</li><li class="nav-item">
<a class="nav-link collapsable collapsed"
data-toggle="collapse" data-target="#sidenav-7-3"
href="#sidenav-7-3" role="button"
aria-expanded="false" aria-controls="sidenav-7-3"
>历史
</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-7-3">
<li class="nav-item">
<a class="nav-link" href="/dart-2">迁移到 Dart 2</a>
</li><li class="nav-item">
<a class="nav-link" href="/web/dart-2">迁移 Web 应用到 Dart 2</a>
</li><li class="nav-item">
<a class="nav-link" href="/tools/pub/obsolete">过时的 Pub 功能</a>
</li></ul>
</li>
</ul>
</li><li class="nav-item">
<a class="nav-link collapsed" data-toggle="collapse" href="#sidenav-8" role="button"
aria-expanded="false" aria-controls="sidenav-8"
>相关网站</a>
<ul class="nav flex-column flex-nowrap collapse " id="sidenav-8">
<li class="nav-item">
<a class="nav-link" href="https://api.dart.dev" target="_blank" rel="noopener">API 参考<i class="fas fa-external-link-alt"></i></a>
</li><li class="nav-item">
<a class="nav-link" href="https://medium.com/dartlang" target="_blank" rel="noopener">Blog<i class="fas fa-external-link-alt"></i></a>
</li><li class="nav-item">
<a class="nav-link" href="https://dartpad.dartlang.org" target="_blank" rel="noopener">DartPad (在线编辑器)<i class="fas fa-external-link-alt"></i></a>
</li><li class="nav-item">
<a class="nav-link" href="https://flutter.dev" target="_blank" rel="noopener">Flutter<i class="fas fa-external-link-alt"></i></a>
</li><li class="nav-item">
<a class="nav-link" href="https://pub.dev" target="_blank" rel="noopener">Pub 包资源<i class="fas fa-external-link-alt"></i></a>
</li>
</ul>
</li><li class="nav-item">
<a class="nav-link " data-toggle="collapse" href="#sidenav-9" role="button"
aria-expanded="true" aria-controls="sidenav-9"
>关于</a>
<ul class="nav flex-column flex-nowrap collapse show" id="sidenav-9">
<li class="nav-item">
<a class="nav-link" href="/about_zh_CN">关于本站</a>
</li><li class="nav-item">
<a class="nav-link" href="/about_zh_CN/contributor-guide">贡献者指北</a>
</li><li class="nav-item">
<a class="nav-link" href="/about_zh_CN/chinese-copywriting-guidelines">中文排版指北</a>
</li>
</ul>
</li></ul>
</div>
</div>
<main id="page-content">
<div id="site-toc--side" class="site-toc ">
<header class="site-toc__title">
大纲
<button type="button" class="btn site-toc--button__page-top" aria-label="Page top"></button>
</header>
<ul class="section-nav nav">
<li class="toc-entry nav-item toc-h2"><a class="nav-link" href="#general">General</a>
<ul class="nav">
<li class="toc-entry nav-item toc-h3"><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 toc-h3"><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 toc-h2"><a class="nav-link" href="#language">Language</a>
<ul class="nav">
<li class="toc-entry nav-item toc-h3"><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 toc-h3"><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 toc-h3"><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 toc-h3"><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 toc-h3"><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 toc-h3"><a class="nav-link" href="#q-can-dart-add-tuples-pattern-matching-non-nullable-types-partial-evaluation-optional-semicolons-">Q. Can Dart add tuples, pattern matching, non-nullable types, partial evaluation, optional semicolons, …?</a></li>
</ul>
</li>
<li class="toc-entry nav-item toc-h2"><a class="nav-link" href="#types">Types</a>
<ul class="nav">
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-is-dart-a-statically-typed-language">Q. Is Dart a statically typed language?</a></li>
<li class="toc-entry nav-item toc-h3"><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 toc-h2"><a class="nav-link" href="#usage-and-tools">Usage and tools</a>
<ul class="nav">
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-does-dart-support-json">Q. Does Dart support JSON?</a></li>
<li class="toc-entry nav-item toc-h3"><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 toc-h3"><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 toc-h3"><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 toc-h3"><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 toc-h3"><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 toc-h2"><a class="nav-link" href="#native-execution">Native execution</a>
<ul class="nav">
<li class="toc-entry nav-item toc-h3"><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 toc-h3"><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>
</ul>
</li>
<li class="toc-entry nav-item toc-h2"><a class="nav-link" href="#web-general">Web: general</a>
<ul class="nav">
<li class="toc-entry nav-item toc-h3"><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 toc-h3"><a class="nav-link" href="#q-is-dart-supported-by-my-browser">Q. Is Dart supported by my browser?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-how-do-i-debug-an-app">Q. How do I debug an app?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-what-web-frameworks-can-i-use-with-dart">Q. What web frameworks can I use with Dart?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-will-the-dart-vm-get-into-chrome">Q. Will the Dart VM get into Chrome?</a></li>
</ul>
</li>
<li class="toc-entry nav-item toc-h2"><a class="nav-link" href="#web-javascript-and-other-technologies">Web: JavaScript and other technologies</a>
<ul class="nav">
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-how-does-dart-code-interoperate-with-javascript-libraries">Q. How does Dart code interoperate with JavaScript libraries?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-i-have-a-large-javascript-codebase-how-can-i-migrate-it-to-dart">Q. I have a large JavaScript codebase. How can I migrate it to Dart?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-how-does-dart-compare-with-using-the-closure-compiler-on-javascript">Q. How does Dart compare with using the Closure compiler on JavaScript?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-how-does-dart-compare-with-coffeescript">Q. How does Dart compare with CoffeeScript?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-what-does-google-think-of-typescript">Q. What does Google think of TypeScript?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-i-have-a-large-app-written-in-gwt-how-do-i-port-it-to-dart">Q. I have a large app written in GWT. How do I port it to Dart?</a></li>
</ul>
</li>
<li class="toc-entry nav-item toc-h2"><a class="nav-link" href="#web-javascript-compilation">Web: JavaScript compilation</a>
<ul class="nav">
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-will-any-valid-dart-code-compile-to-javascript-or-are-there-limitations">Q. Will any valid Dart code compile to JavaScript, or are there limitations?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-why-does-dart-have-two-javascript-compilers-dartdevc-and-dart2js">Q. Why does Dart have two JavaScript compilers, dartdevc and dart2js?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-how-can-dart2js-produce-javascript-that-runs-faster-than-handwritten-javascript">Q. How can dart2js produce JavaScript that runs faster than handwritten JavaScript?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-how-can-i-write-dart-code-that-compiles-to-performant-javascript">Q. How can I write Dart code that compiles to performant JavaScript?</a></li>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-why-is-the-code-for-hello-world-so-big-compared-to-the-original-dart-code-after-compilation-to-javascript">Q. Why is the code for “Hello, World” so big, compared to the original Dart code after compilation to JavaScript?</a></li>
<li class="toc-entry nav-item toc-h3"><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 toc-h3"><a class="nav-link" href="#q-how-are-integers-handled-when-compiled-to-javascript">Q. How are integers handled when compiled to JavaScript?</a></li>
<li class="toc-entry nav-item toc-h3"><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>
<li class="toc-entry nav-item toc-h3"><a class="nav-link" href="#q-why-not-compile-dart-to-asmjs-instead-of-javascript">Q. Why not compile Dart to asm.js instead of JavaScript?</a></li>
</ul>
</li>
</ul>
</div>
<article>
<div class="content">
<div>
<div id="page-github-links" class="btn-group" aria-label="Page GitHub links" role="group">
<a href="https://github.com/dartchina/site-www-cn/tree/src_zh_CN/src_zh_CN/faq.md" class="btn no-automatic-external" title="View page source" target="_blank" rel="noopener">
<i class="fas fa-file-alt fa-sm"></i>
</a>
<a href="https://github.com/dartchina/site-www-cn/issues/new?title='Dart FAQ' page issue&body=
Page URL: https://www.dartlang.org/faq.html%0D%0A
Page source: https://github.com/dartchina/site-www-cn/tree/src_zh_CN/src_zh_CN/faq.md%0D%0A
%0D%0A
Found a typo? You can fix it yourself by going to the page source and clicking the pencil icon. Or finish creating this issue.%0D%0A
%0D%0A
Description of issue:" class="btn no-automatic-external" title="Report an issue with this page"
target="_blank" rel="noopener">
<i class="fas fa-bug fa-sm"></i>
</a>
</div>
<h1>Dart FAQ</h1>
</div>
<div id="site-toc--inline" class="site-toc toc-collapsible toc-collapsed">
<header class="site-toc__title">
大纲
<button type="button" class="btn site-toc--button__page-top" aria-label="Page top"></button>
<span class="site-toc--inline__toggle toc-toggle-down"><i class="fas fa-chevron-down fa-m"></i></span>
<span class="site-toc--inline__toggle toc-toggle-up"><i class="fas fa-chevron-up fa-m"></i></span>
</header>
<ul class="section-nav">
<li class="toc-entry toc-h2"><a href="#general">General</a>
<ul>
<li class="toc-entry toc-h3"><a href="#q-is-there-a-specification-for-dart">Q. Is there a specification for Dart?</a></li>
<li class="toc-entry toc-h3"><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 toc-h2"><a href="#language">Language</a>
<ul>
<li class="toc-entry toc-h3"><a href="#q-isnt-dart-a-lot-like-java">Q. Isn’t Dart a lot like Java?</a></li>
<li class="toc-entry toc-h3"><a href="#q-how-does-dart-relate-to-go">Q. How does Dart relate to Go?</a></li>
<li class="toc-entry toc-h3"><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 toc-h3"><a href="#q-why-isnt-dart-syntax-more-exciting">Q. Why isn’t Dart syntax more exciting?</a></li>
<li class="toc-entry toc-h3"><a href="#q-does-dart-have-reflection-capabilities">Q. Does Dart have reflection capabilities?</a></li>
<li class="toc-entry toc-h3"><a href="#q-can-dart-add-tuples-pattern-matching-non-nullable-types-partial-evaluation-optional-semicolons-">Q. Can Dart add tuples, pattern matching, non-nullable types, partial evaluation, optional semicolons, …?</a></li>
</ul>
</li>
<li class="toc-entry toc-h2"><a href="#types">Types</a>
<ul>
<li class="toc-entry toc-h3"><a href="#q-is-dart-a-statically-typed-language">Q. Is Dart a statically typed language?</a></li>
<li class="toc-entry toc-h3"><a href="#q-why-are-generics-covariant">Q. Why are generics covariant?</a></li>
</ul>
</li>
<li class="toc-entry toc-h2"><a href="#usage-and-tools">Usage and tools</a>
<ul>
<li class="toc-entry toc-h3"><a href="#q-does-dart-support-json">Q. Does Dart support JSON?</a></li>
<li class="toc-entry toc-h3"><a href="#q-can-dart-run-on-the-server">Q. Can Dart run on the server?</a></li>
<li class="toc-entry toc-h3"><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 toc-h3"><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 toc-h3"><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 toc-h3"><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 toc-h2"><a href="#native-execution">Native execution</a>
<ul>
<li class="toc-entry toc-h3"><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 toc-h3"><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>
</ul>
</li>
<li class="toc-entry toc-h2"><a href="#web-general">Web: general</a>
<ul>
<li class="toc-entry toc-h3"><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 toc-h3"><a href="#q-is-dart-supported-by-my-browser">Q. Is Dart supported by my browser?</a></li>
<li class="toc-entry toc-h3"><a href="#q-how-do-i-debug-an-app">Q. How do I debug an app?</a></li>
<li class="toc-entry toc-h3"><a href="#q-what-web-frameworks-can-i-use-with-dart">Q. What web frameworks can I use with Dart?</a></li>
<li class="toc-entry toc-h3"><a href="#q-will-the-dart-vm-get-into-chrome">Q. Will the Dart VM get into Chrome?</a></li>
</ul>
</li>
<li class="toc-entry toc-h2"><a href="#web-javascript-and-other-technologies">Web: JavaScript and other technologies</a>
<ul>
<li class="toc-entry toc-h3"><a href="#q-how-does-dart-code-interoperate-with-javascript-libraries">Q. How does Dart code interoperate with JavaScript libraries?</a></li>
<li class="toc-entry toc-h3"><a href="#q-i-have-a-large-javascript-codebase-how-can-i-migrate-it-to-dart">Q. I have a large JavaScript codebase. How can I migrate it to Dart?</a></li>
<li class="toc-entry toc-h3"><a href="#q-how-does-dart-compare-with-using-the-closure-compiler-on-javascript">Q. How does Dart compare with using the Closure compiler on JavaScript?</a></li>
<li class="toc-entry toc-h3"><a href="#q-how-does-dart-compare-with-coffeescript">Q. How does Dart compare with CoffeeScript?</a></li>
<li class="toc-entry toc-h3"><a href="#q-what-does-google-think-of-typescript">Q. What does Google think of TypeScript?</a></li>
<li class="toc-entry toc-h3"><a href="#q-i-have-a-large-app-written-in-gwt-how-do-i-port-it-to-dart">Q. I have a large app written in GWT. How do I port it to Dart?</a></li>
</ul>
</li>
<li class="toc-entry toc-h2"><a href="#web-javascript-compilation">Web: JavaScript compilation</a>
<ul>
<li class="toc-entry toc-h3"><a href="#q-will-any-valid-dart-code-compile-to-javascript-or-are-there-limitations">Q. Will any valid Dart code compile to JavaScript, or are there limitations?</a></li>
<li class="toc-entry toc-h3"><a href="#q-why-does-dart-have-two-javascript-compilers-dartdevc-and-dart2js">Q. Why does Dart have two JavaScript compilers, dartdevc and dart2js?</a></li>
<li class="toc-entry toc-h3"><a href="#q-how-can-dart2js-produce-javascript-that-runs-faster-than-handwritten-javascript">Q. How can dart2js produce JavaScript that runs faster than handwritten JavaScript?</a></li>
<li class="toc-entry toc-h3"><a href="#q-how-can-i-write-dart-code-that-compiles-to-performant-javascript">Q. How can I write Dart code that compiles to performant JavaScript?</a></li>
<li class="toc-entry toc-h3"><a href="#q-why-is-the-code-for-hello-world-so-big-compared-to-the-original-dart-code-after-compilation-to-javascript">Q. Why is the code for “Hello, World” so big, compared to the original Dart code after compilation to JavaScript?</a></li>
<li class="toc-entry toc-h3"><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 toc-h3"><a href="#q-how-are-integers-handled-when-compiled-to-javascript">Q. How are integers handled when compiled to JavaScript?</a></li>
<li class="toc-entry toc-h3"><a href="#q-how-are-typed-lists-handled-when-compiled-to-javascript">Q. How are typed lists handled when compiled to JavaScript?</a></li>
<li class="toc-entry toc-h3"><a href="#q-why-not-compile-dart-to-asmjs-instead-of-javascript">Q. Why not compile Dart to asm.js instead of JavaScript?</a></li>
</ul>
</li>
</ul>
</div>
<p><em>Updated June 2019</em></p>
<p>This page collects some of the top questions we’ve heard from the community
since Dart was open sourced.</p>
<h2 id="general">
<a id="general" class="anchor" href="#general" aria-hidden="true"><span class="octicon octicon-link"></span></a>General</h2>
<h3 id="q-is-there-a-specification-for-dart">
<a id="q-is-there-a-specification-for-dart" class="anchor" href="#q-is-there-a-specification-for-dart" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Is there a specification for Dart?</h3>
<p>Yes. Dart 1 has a formal specification owned by <a href="https://news.dartlang.org/2013/12/ecma-forms-tc52-for-dart-standardization.html">Ecma TC52</a>.</p>
<p>Dart 2.x is currently being specified; the specification is available from the
<a href="/guides/language/spec">Dart language specification</a> page.</p>
<h3 id="q-how-are-you-taking-input-on-changes-to-dart">
<a id="q-how-are-you-taking-input-on-changes-to-dart" class="anchor" href="#q-how-are-you-taking-input-on-changes-to-dart" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. How are you taking input on changes to Dart?</h3>
<p>We listen to feedback and <a href="https://github.com/dart-lang/sdk/issues">issues,</a> and we review patches from contributors.
A contributor with a good track record can become a committer to the repository.
Google engineers will also be working in the public repository, making visible
changes. The project is lucky to have received many external patches and has
welcomed distributed committers.</p>
<hr>
<h2 id="language">
<a id="language" class="anchor" href="#language" aria-hidden="true"><span class="octicon octicon-link"></span></a>Language</h2>
<h3 id="q-isnt-dart-a-lot-like-java">
<a id="q-isnt-dart-a-lot-like-java" class="anchor" href="#q-isnt-dart-a-lot-like-java" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Isn’t Dart a lot like Java?</h3>
<p>Dart has some similarities with Java. See the <a href="https://codelabs.developers.google.com/codelabs/from-java-to-dart/">Intro to Dart for Java
Developers</a>
codelab for examples of some of the differences between Dart and Java.</p>
<h3 id="q-how-does-dart-relate-to-go">
<a id="q-how-does-dart-relate-to-go" class="anchor" href="#q-how-does-dart-relate-to-go" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. How does Dart relate to Go?</h3>
<p>Dart and Go are both language projects started at Google, but they
are independent and have different goals. As a result,
they make different choices, and the languages have very different
natures, even while we all try to learn from each others’ work.</p>
<h3 id="q-why-isnt-dart-more-like-haskell--smalltalk--python--scala--other-language">
<a id="q-why-isnt-dart-more-like-haskell--smalltalk--python--scala--other-language" class="anchor" href="#q-why-isnt-dart-more-like-haskell--smalltalk--python--scala--other-language" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Why isn’t Dart more like Haskell / Smalltalk / Python / Scala / other language?</h3>
<p>Various reasons, depending on the language being asked about.</p>
<p>For languages that are quite different from JavaScript: it’s important for Dart
to compile to efficient JavaScript. Our experience in GWT is that if the source
language is too different from JavaScript, it creates some cases where complex
output code is needed to emulate the source language’s behavior. This can cause
performance to vary in ways that are not transparent to the programmer.</p>
<p>For languages that are compiled to native code: it’s important that Dart
compiles efficiently to machine code, and thus it shares a number of aspects
with other compiled languages.</p>
<p>For languages that are “more dynamic” than Dart: Dart deliberately trades off
some of this arbitrary runtime modification for the goal of better performance
and more productive tools.</p>
<h3 id="q-why-isnt-dart-syntax-more-exciting">
<a id="q-why-isnt-dart-syntax-more-exciting" class="anchor" href="#q-why-isnt-dart-syntax-more-exciting" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Why isn’t Dart syntax more exciting?</h3>
<p>We did throw in some nice syntactic features such as <code class="highlighter-rouge">this.</code> constructor args
and <code class="highlighter-rouge">=></code> for one-line functions, but we’d agree that Dart chooses
familiarity over excitement. One team member’s personal testimonial:
“I wish it had a little more razzle dazzle but I can’t deny that
literally on my first day of writing Dart code, I was productive in it.”</p>
<h3 id="q-does-dart-have-reflection-capabilities">
<a id="q-does-dart-have-reflection-capabilities" class="anchor" href="#q-does-dart-have-reflection-capabilities" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Does Dart have reflection capabilities?</h3>
<p>For servers and command-line scripts, we have reflection support from the
<a href="https://api.dart.dev/stable/dart-mirrors">mirrors API.</a>
There is no support for mirrors when using Dart to write web or
Flutter apps (<a href="https://flutter.dev/faq/#does-flutter-come-with-a-reflectionmirrors-system">more info</a>).</p>
<h3 id="q-can-dart-add-tuples-pattern-matching-non-nullable-types-partial-evaluation-optional-semicolons-">
<a id="q-can-dart-add-tuples-pattern-matching-non-nullable-types-partial-evaluation-optional-semicolons-" class="anchor" href="#q-can-dart-add-tuples-pattern-matching-non-nullable-types-partial-evaluation-optional-semicolons-" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Can Dart add tuples, pattern matching, non-nullable types, partial evaluation, optional semicolons, …?</h3>
<p>Future releases might be able to include (some of) those features, although
we can’t include everything. Some features don’t fit the basic nature of the
language, and some don’t play well with other features. Simplicity is the single
most important gift we can give to future programmers.</p>
<p>Please look at 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> to see if your request is already there.
If it is, let us know that you care and give it a thumbs up. Otherwise, go ahead
and add a new request issue (see the [language evolution process][languageprocess]
for details). Make a thoughtful argument for your feature. Sample code with and
without your feature is good evidence; a sizeable codebase that shows the need
is even better evidence.</p>
<p>Don’t be surprised if the Dart language team says “no” by default.
It’s far more painful to remove a language feature than to add it, so
Dart is likely to add the most obvious features first, and then revisit the next
tier later. And there simply are more possible language features in the world
that can fit into any single language without making a total hash of it. But
we do very much appreciate suggestions and evidence. We hope you’ll see our
appreciation through careful design choices and fair communication about them.</p>
<hr>
<h2 id="types">
<a id="types" class="anchor" href="#types" aria-hidden="true"><span class="octicon octicon-link"></span></a>Types</h2>
<h3 id="q-is-dart-a-statically-typed-language">
<a id="q-is-dart-a-statically-typed-language" class="anchor" href="#q-is-dart-a-statically-typed-language" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Is Dart a statically typed language?</h3>
<p>Yes, Dart 2 is statically typed. For more information,
read about <a href="/guides/language/sound-dart">Dart’s type system</a>.</p>
<p>With its combination of static and runtime checks, Dart has a sound type system,
which guarantees that an expression of one type cannot produce a value of
another type. No surprises!</p>
<p>Even with type-safe Dart, you can annotate any variable with
<code class="highlighter-rouge">dynamic</code> if you need the flexibility of a dynamic language.
The <code class="highlighter-rouge">dynamic</code> type itself is static, but can contain any type at runtime.
Of course, that removes many of the benefits of a type-safe language
for that variable.</p>
<h3 id="q-why-are-generics-covariant">
<a id="q-why-are-generics-covariant" class="anchor" href="#q-why-are-generics-covariant" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Why are generics covariant?</h3>
<p>Covariant generics fit a common intuition that programmers have, and very often
this intuition is correct, such as in the common “read-only” 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 “apples”, and someone just wants “fruits”.</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>
<h2 id="usage-and-tools">
<a id="usage-and-tools" class="anchor" href="#usage-and-tools" aria-hidden="true"><span class="octicon octicon-link"></span></a>Usage and tools</h2>
<h3 id="q-does-dart-support-json">
<a id="q-does-dart-support-json" class="anchor" href="#q-does-dart-support-json" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Does Dart support JSON?</h3>
<p>Yes. See the <a href="https://api.dart.dev/stable/dart-convert/JsonCodec-class.html">JSON</a> converters in the dart:convert library.</p>
<h3 id="q-can-dart-run-on-the-server">
<a id="q-can-dart-run-on-the-server" class="anchor" href="#q-can-dart-run-on-the-server" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Can Dart run on the server?</h3>
<p>Yes. See <a href="https://dart-lang.github.io/server/">Dart on the Server</a> for details.</p>
<h3 id="q-how-do-i-use-third-party-code-or-share-code">
<a id="q-how-do-i-use-third-party-code-or-share-code" class="anchor" href="#q-how-do-i-use-third-party-code-or-share-code" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. How do I use third party code, or share code?</h3>
<p>You can find many packages on the <a href="https://pub.dev">Pub site</a> a service for hosting
packages of Dart code. Use the <code class="highlighter-rouge">pub</code> command to package your code and upload
to the site.</p>
<h3 id="q-do-i-need-to-use-a-particular-editor-or-ide-to-write-dart-code">
<a id="q-do-i-need-to-use-a-particular-editor-or-ide-to-write-dart-code" class="anchor" href="#q-do-i-need-to-use-a-particular-editor-or-ide-to-write-dart-code" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Do I need to use a particular editor or IDE to write Dart code?</h3>
<p>Nope. You can try out Dart code with <a href="https://dartpad.cn">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>
<h3 id="q-can-i-build-an-android-app-with-dart">
<a id="q-can-i-build-an-android-app-with-dart" class="anchor" href="#q-can-i-build-an-android-app-with-dart" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Can I build an Android app with Dart?</h3>
<p>Yes! You can build an Android app that also works on iOS from a single codebase
using <a href="https://flutter.dev">Flutter</a>, which is powered by the Dart platform.</p>
<h3 id="q-what-are-some-real-world-production-deployments-of-dart">
<a id="q-what-are-some-real-world-production-deployments-of-dart" class="anchor" href="#q-what-are-some-real-world-production-deployments-of-dart" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. What are some real-world production deployments of Dart?</h3>
<p>Google AdWords, AdSense, AdMob, and the Google Assistant all use Dart.
A significant portion of Google’s revenue flows through these apps.
Inside or outside of Google, every Flutter app uses Dart.</p>
<hr>
<h2 id="native-execution">
<a id="native-execution" class="anchor" href="#native-execution" aria-hidden="true"><span class="octicon octicon-link"></span></a>Native execution</h2>
<h3 id="q-can-i-compile-dart-code-to-native-code">
<a id="q-can-i-compile-dart-code-to-native-code" class="anchor" href="#q-can-i-compile-dart-code-to-native-code" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Can I compile Dart code to native code?</h3>
<p>Yes. For programs targeting devices (mobile, desktop, server, and more), <a href="/platforms#dart-native-vm-jit-and-aot">Dart
Native</a> includes both a Dart VM with JIT
(just-in-time) compilation and an AOT (ahead-of-time) compiler for producing
machine code.</p>
<p><a href="https://flutter.dev">Flutter</a> is a sample framework that uses Dart’s native compilation capability
to produce fast native apps.</p>
<h3 id="q-can-i-compile-a-dart-program-for-running-in-a-terminal">
<a id="q-can-i-compile-a-dart-program-for-running-in-a-terminal" class="anchor" href="#q-can-i-compile-a-dart-program-for-running-in-a-terminal" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Can I compile a Dart program for running in a terminal?</h3>
<p>Yes. Dart programs can be compiled to native x64 machine code for running in a
Terminal/Command Prompt on desktop operating systems such as Windows, macOS, and
Linux. For more details, see the <a href="/tools/dart2aot">dart2aot</a> documentation.</p>
<hr>
<h2 id="web-general">
<a id="web-general" class="anchor" href="#web-general" aria-hidden="true"><span class="octicon octicon-link"></span></a>Web: general</h2>
<h3 id="q-what-browsers-do-you-support-as-javascript-compilation-targets">
<a id="q-what-browsers-do-you-support-as-javascript-compilation-targets" class="anchor" href="#q-what-browsers-do-you-support-as-javascript-compilation-targets" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. What browsers do you support as JavaScript compilation targets?</h3>
<p>The <em>production</em> compiler (<a href="/tools/dart2js">dart2js</a>) supports Internet Explorer 11
and the last two major releases of the following browsers:</p>
<ul>
<li>Chrome</li>
<li>Edge</li>
<li>Firefox</li>
<li>Safari</li>
</ul>
<p>The <em>development</em> compiler (<a href="/tools/dartdevc">dartdevc</a>) supports only Chrome.</p>
<h3 id="q-is-dart-supported-by-my-browser">
<a id="q-is-dart-supported-by-my-browser" class="anchor" href="#q-is-dart-supported-by-my-browser" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Is Dart supported by my browser?</h3>
<p>Although no production browsers can execute Dart code directly,
all modern browsers can execute Dart code that’s been compiled to JavaScript.</p>
<h3 id="q-how-do-i-debug-an-app">
<a id="q-how-do-i-debug-an-app" class="anchor" href="#q-how-do-i-debug-an-app" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. How do I debug an app?</h3>
<p>For setup details and a walkthrough, see <a href="/web/debugging">Debugging Dart Web Apps</a>.</p>
<p>The <a href="/tools/dart2js#debugging">debugging</a> section of the dart2js documentation
has some tips for specific browsers.</p>
<h3 id="q-what-web-frameworks-can-i-use-with-dart">
<a id="q-what-web-frameworks-can-i-use-with-dart" class="anchor" href="#q-what-web-frameworks-can-i-use-with-dart" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. What web frameworks can I use with Dart?</h3>
<p>You can use the low-level HTML API defined by core libraries such as dart:html,
or you can use a framework such as <a href="https://webdev.dartlang.org/angular">AngularDart</a>.
During Google I/O 2019 we <a href="https://medium.com/flutter-io/bringing-flutter-to-the-web-904de05f0df0">announced</a> a technical preview of
<a href="https://flutter.dev/web">Flutter for web</a> that lets you take Flutter UI code and business logic
and run it directly in the browser.</p>
<h3 id="q-will-the-dart-vm-get-into-chrome">
<a id="q-will-the-dart-vm-get-into-chrome" class="anchor" href="#q-will-the-dart-vm-get-into-chrome" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. Will the Dart VM get into Chrome?</h3>
<p><a href="http://news.dartlang.org/2015/03/dart-for-entire-web.html">No.</a>
Dart is designed to compile to JavaScript to run across the modern web.</p>
<hr>
<h2 id="web-javascript-and-other-technologies">
<a id="web-javascript-and-other-technologies" class="anchor" href="#web-javascript-and-other-technologies" aria-hidden="true"><span class="octicon octicon-link"></span></a>Web: JavaScript and other technologies</h2>
<h3 id="q-how-does-dart-code-interoperate-with-javascript-libraries">
<a id="q-how-does-dart-code-interoperate-with-javascript-libraries" class="anchor" href="#q-how-does-dart-code-interoperate-with-javascript-libraries" aria-hidden="true"><span class="octicon octicon-link"></span></a>Q. How does Dart code interoperate with JavaScript libraries?</h3>
<p>Although Dart and JavaScript are completely separate languages with
separate VMs, they can interoperate. For more information, see
<a href="/web/js-interop">JavaScript and TypeScript interop</a>.</p>