Dart 语言中的保留关键字

abstract 2dynamic 2implements 2show 1
as 2elseimport 2static 2
assertenuminsuper
async 1export 2interface 2switch
await 3extendsissync 1
breakexternal 2library 2this
casefactory 2mixin 2throw
catchfalsenewtrue
classfinalnulltry
constfinallyon 1typedef 2
continueforoperator 2var
covariant 2Function 2part 2void
defaultget 2rethrowwhile
deferred 2hide 1returnwith
doifset 2yield 3

声明的标识符  尽量避免表中的关键词 但如果需要 也可以用其命名

  1. 右上角角标为 1 的单词是上下文关键字 只在特定的地方才具有意义 这些关键字在代码的任何地方都是有效的

  2. 右上角角标为 2 的单词是内置关键字 为了简化将 JavaScript 代码移植到 Dart 这些关键字在大多数地方都是有效的标识符  不能用在 类(class) 或 类型名称(Type names) 中 也不能用作导入前缀

  3. 右上角角标为 3 的单词 新发布的关键字  Dart 语言的保留关键字 在任何函数中 不能使用 awaityield 来修饰 async async* 或者 sync*

  4. 表格中无角标的单词都是系统保留关键字 不能作为标识符