키워드

키워드 (Keywords)

다음 표는 Dart 언어가 자기만의 용도로 예약해 둔 단어들을 정리한 거예요. 이 단어들은 특별히 언급된 경우가 아니라면 식별자(identifier)로 쓸 수 없어요. 설령 쓸 수 있다 해도, 키워드를 식별자로 쓰면 코드를 읽는 다른 개발자를 헷갈리게 할 수 있으니 피하는 게 좋아요.

출처: Dart 공식 문서 - Keywords

본문

abstract² as² assert async³
await¹ base³ break case
catch class const continue
covariant² default deferred² do
dynamic² else enum export²
extends extension² external² factory²
false final (var) final (class) finally
for Function² get² hide³
if implements² import² in
interface² is late² library²
mixin² new null of³
on³ operator² part² required²
rethrow return sealed³ set²
show³ static² super switch
sync³ this throw true
try type² typedef² var
void when³ with while
yield¹

표에 붙은 위첨자 숫자는 이런 뜻이에요.

  1. ¹ 이 키워드는 문맥에 따라 식별자로 쓸 수 있어요.
  2. ² 이 키워드는 타입(클래스, 믹스인, enum, extension type, 타입 별칭)의 이름, 확장의 이름, 또는 import 접두어로는 쓸 수 없어요. 그 외의 상황에서는 식별자로 쓸 수 있죠.
  3. ³ 이 키워드는 제한 없이 식별자로 쓸 수 있어요.

더 알아보기 (Learn more)

  • Dart 공식 문서 - Keywords 원문 살펴보기
  • 각 키워드가 실제로 어떻게 쓰이는지는 클래스, 함수, 연산자, 타입 시스템 등 해당 주제의 문서에서 다뤄져요.