下面表格列出了 Dart 語(yǔ)言的關(guān)鍵字:
關(guān)鍵字 | 關(guān)鍵字 | 關(guān)鍵字 | 關(guān)鍵字 | 關(guān)鍵字 |
---|---|---|---|---|
abstract 1 | continue | false | new | this |
as 1 | default | final | null | throw |
assert | deferred 1 | finally | operator 1 | true |
async 2 | do | for | part 1 | try |
async* 2 | dynamic 1 | get 1 | rethrow | typedef 1 |
await 2 | else | if | return | var |
break | enum | implements 1 | set 1 | void |
case | export 1 | import 1 | static 1 | while |
catch | external 1 | in | super | with |
class | extends | is | switch | yield 2 |
const | factory1 | library 1 | sync* 2 | yield* 2 |
上標(biāo)1的單詞是內(nèi)置的標(biāo)識(shí)符(built-in identifiers)。避免使用表格內(nèi)的標(biāo)識(shí)作為符標(biāo)識(shí),而且從來(lái)不使用它們作為類(class)或類型(type)的名稱。內(nèi)置標(biāo)識(shí)符存在,以方便從 JavaScript 到 Dart 的移植。例如,如果一些JavaScript代碼中有一個(gè)名為工廠的變量,當(dāng)你將代碼移植到 Datr 中,你不必重新命名它。
上標(biāo)2的單詞是的Dart1.0版本之后添加異步支持較新的、有限的保留字。不能使用async,await,或yield作為在標(biāo)有async,或sync的任何函數(shù)體的標(biāo)識(shí)符。欲了解更多信息,請(qǐng)參見(jiàn) 異步性支持(Asynchrony support)。