Dart 语言中的保留关键字
abstract 2 | dynamic 2 | implements 2 | show 1 |
---|---|---|---|
as 2 | else | import 2 | static 2 |
assert | enum | in | super |
async 1 | export 2 | interface 2 | switch |
await 3 | extends | is | sync 1 |
break | external 2 | library 2 | this |
case | factory 2 | mixin 2 | throw |
catch | false | new | true |
class | final | null | try |
const | finally | on 1 | typedef 2 |
continue | for | operator 2 | var |
covariant 2 | Function 2 | part 2 | void |
default | get 2 | rethrow | while |
deferred 2 | hide 1 | return | with |
do | if | set 2 | yield 3 |
声明的标识符 尽量避免表中的关键词 但如果需要 也可以用其命名
右上角角标为 1 的单词是上下文关键字 只在特定的地方才具有意义 这些关键字在代码的任何地方都是有效的
右上角角标为 2 的单词是内置关键字 为了简化将 JavaScript 代码移植到 Dart 这些关键字在大多数地方都是有效的标识符 不能用在 类(class) 或 类型名称(Type names) 中 也不能用作导入前缀
右上角角标为 3 的单词 新发布的关键字 Dart 语言的保留关键字 在任何函数中 不能使用 await 或 yield 来修饰 async async* 或者 sync*
表格中无角标的单词都是系统保留关键字 不能作为标识符
尊贵的董事大人
英文标题不为空时 视为本栏投稿
需要关键字 描述 英文标题