# Dart Code Style

## [3가지 유형의 코드 스타일](https://dart.dev/guides/language/effective-dart/style)&#x20;

### UpperCamelCase

각 단어의 첫 글자 (첫 번째 단어 포함)를 대문자로 표시하고 구분 기호를 사용하지 않아야 함 :

***클래스, 열거 형 유형, typedef 및 유형 매개 변수***&#xC5D0; 사용

```dart
class SliderMenu { ... }
class HttpRequest { ... }

typedef Predicate<T> = bool Function(T value);

extension MyFancyList<T> on List<T> { ... }

extension SmartIterable<T> on Iterable<T> { ... }

class HttpConnection {}
class DBIOPort {}
class TVVcr {}
class MrRogers {}
```

### lowerCamelCase

첫 번째 단어는 소문자로 표시하고 각 단어의 첫 글자는 대문자료 표시 :

***클래스 멤버, 최상위 수준 정의, 변수, 매개 변수 및 명명 된 매개 변수***&#xC5D0; 사용&#x20;

```dart
var item;

HttpRequest httpRequest;

void align(bool clearItems) {
  // ...
}

var httpRequest = ...
var uiHandler = ...
Id id;
```

{% hint style="info" %}
동사형(DO) 약어 문자는 단어처럼 사용합니다. (HTTP =>  Http)\
IO(입/출력)와 같이 두 글자 약어는 모두 대문자로 표시합니다. 다만, ID는 첫 번째 문자만 대문자로 작성합니다.&#x20;
{% endhint %}

### lowercase\_with\_underscores

소문자와 \_(밑줄)  만 사용합니다.&#x20;

**라이브러리, 패키지, 디렉토리** 이름에 사용합니다.&#x20;

```dart
library peg_parser.source_scanner;

import 'file_system.dart';
import 'slider_menu.dart';
```

### 사용하지 않는 콜백 변수에는 \_ 또는 \_ \_ 를 사용&#x20;

```dart
futureOfVoid.then((_) {
  print('Operation complete.');
});
```

### Private 식별자에만 \_로 시작하여 사용&#x20;

Dart는 최상위 선언하는 Private 멤버 및 변수의 경우 첫번째 문자를 \_(밑줄)로 시작합니다. 지역변수/함수 및 파라미터 경우 Private 개념이 없어 \_(밑줄)을 사용해도 상관없으나, 소스 가독성을 위해 Private 식별자에만 사용하는 것이 좋습니다.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://flutter.kgoon.net/undefined-1/dart/dart-code-style.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
