Dart的关键字

Dart的关键字

https://dart.dev/guides/language/

language-tour#importing-only-part-of-a-library

先上图


Dart的关键字_第1张图片
15688214019753.jpg

Dart一共有60个关键字


关键字1
show async sync on
hide

Words with the superscript 1 are contextual keywords, which have meaning only in specific places. They’re valid identifiers everywhere.

带有上标1的单词是上下文关键字,仅在特定位置具有含义。它们无处不在是有效的标识符。


关键字2
abstract dynamic implements as
import static export interface
external library factory mixin
typedef operator covariant Function
part get set deferred

Words with the superscript 2 are built-in identifiers. To simplify the task of porting JavaScript code to Dart, these keywords are valid identifiers in most places, but they can’t be used as class or type names, or as import prefixes.

带有上标2的单词是内置标识符。为了简化将JavaScript代码移植到Dart的任务,这些关键字在大多数地方都是有效的标识符,但它们不能用作类或类型名称,也不能用作导入前缀。


关键字3
await yield

Words with the superscript 3 are newer, limited reserved words related to the asynchrony support that was added after Dart’s 1.0 release. You can’t use await or yield as an identifier in any function body marked with async, async*, or sync*.

带有上标3的单词是与Dart 1.0发布后添加的异步支持相关的更新,有限的保留字。不能使用await或yield作为任何函数体中的标识符标记async,async*或sync*。


保留字,不能是标识符。

其它
else assert enum in
super switch extends is
break this case throw
catch false new true
class final null try
const finally continue for
var void rethrow while
return with do if
default

你可能感兴趣的:(Dart的关键字)