Targets · Dart · Reserved words
Reserved words
Dart keeps a set of words for its own syntax, so a program cannot use them as names. When a Program
name collides with one, the renderer appends a single underscore — class becomes
class_ — so the program keeps the name it chose and the output still compiles.
Because _ is illegal in a Program identifier, the escape can never collide with a name a
program actually chose.
Contents
How a Program becomes Dart, in parts. Start with the introduction, then follow each part into the rendered output and the runtime it links against.
- Introduction — what the Dart target is, and how to read the rest of this section.
- Capabilities — which high-level features are possible, built in or through a library.
- Example — a full program using every keyword, and the Dart it renders to.
- Naming considerations — how Program's dotted names are carried into Dart.
- Entry point — starting a program and mounting it as a Flutter app.
- Drivers — the native drivers that provide the interface, animation and network.
- Runtime — the Reactive and Context machinery the rendered code links against.
- Native modules — the hand-written Dart behind
NATIVEfunctions. - Keywords — how each of Program's keywords renders to Dart.
- Project setup — the files and commands to build and run the rendered program.
- Reserved words — the words Dart keeps for itself, and how a colliding name is escaped.
The full list
Every word Dart reserves, with the identifier a colliding Program name is escaped to. The rule is
uniform — append a single _:
| Reserved word | Rendered identifier |
|---|---|
abstract | abstract_ |
as | as_ |
assert | assert_ |
async | async_ |
await | await_ |
break | break_ |
case | case_ |
catch | catch_ |
class | class_ |
const | const_ |
continue | continue_ |
covariant | covariant_ |
default | default_ |
deferred | deferred_ |
do | do_ |
dynamic | dynamic_ |
else | else_ |
enum | enum_ |
export | export_ |
extends | extends_ |
extension | extension_ |
external | external_ |
factory | factory_ |
false | false_ |
final | final_ |
finally | finally_ |
for | for_ |
function | function_ |
get | get_ |
hide | hide_ |
if | if_ |
implements | implements_ |
import | import_ |
in | in_ |
interface | interface_ |
is | is_ |
late | late_ |
library | library_ |
mixin | mixin_ |
new | new_ |
null | null_ |
on | on_ |
operator | operator_ |
part | part_ |
required | required_ |
rethrow | rethrow_ |
return | return_ |
sealed | sealed_ |
set | set_ |
show | show_ |
static | static_ |
super | super_ |
switch | switch_ |
sync | sync_ |
this | this_ |
throw | throw_ |
true | true_ |
try | try_ |
typedef | typedef_ |
var | var_ |
void | void_ |
while | while_ |
with | with_ |
yield | yield_ |