Files
2nd/10_Wiki/Topics/Domain_Programming/Frontend/Dart.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

5.0 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-dart Dart 10_Wiki/Topics verified self
Dart language
dart-lang
none A 0.9 applied
dart
flutter
language
aot
jit
2026-05-10 pending
language framework
dart flutter

Dart

매 한 줄

"매 client-optimized language — JIT(dev) + AOT(prod) dual compile, sound null safety, isolate concurrency". 매 Google 의 Flutter 전용으로 설계 (2011→2018 pivot). 매 Dart 3.3+ (2024-2026) 의 records, patterns, sealed class 의 modern type system 도입.

매 핵심

매 dual compilation

  • JIT (development): 매 hot reload < 1s — Flutter dev 의 핵심.
  • AOT (production): 매 native machine code — startup 빠름, deterministic perf.
  • dart2js / dart2wasm: 매 web target — Flutter Web 의 binary.

매 sound null safety (since 2.12)

  • String? (nullable) vs String (non-null) 의 compile-time 보장.
  • late keyword — 매 deferred init.
  • ! (bang) — 매 명시적 unwrap.

매 Dart 3 의 modern features

  • Records: (int, String) lightweight tuple.
  • Patterns: destructuring + switch expression.
  • Sealed classes: 매 exhaustive matching.
  • Class modifiers: final, interface, base, sealed.

매 isolate concurrency

  • 매 single-threaded event loop per isolate.
  • 매 message-passing (no shared memory).
  • Isolate.run() (Dart 2.19+) 의 simple offload.

💻 패턴

Null safety + late

class User {
  final String name;
  final String? nickname; // nullable
  late final int age;     // deferred init

  User(this.name, {this.nickname});

  void setAge(int a) => age = a;
}

final u = User('Yuna');
print(u.nickname?.toUpperCase() ?? 'NO NICK');

Records (Dart 3)

(double, double) toPolar(double x, double y) =>
  (sqrt(x * x + y * y), atan2(y, x));

final (r, theta) = toPolar(3, 4);
print('r=$r, θ=$theta');

// Named record
({String name, int age}) profile = (name: 'Yuna', age: 28);
print(profile.name);

Patterns + switch expression

sealed class Shape {}
class Circle extends Shape { final double r; Circle(this.r); }
class Square extends Shape { final double s; Square(this.s); }

double area(Shape sh) => switch (sh) {
  Circle(:final r) => 3.14159 * r * r,
  Square(:final s) => s * s,
};

Async/await + Future

Future<User> fetchUser(int id) async {
  final res = await http.get(Uri.parse('https://api/u/$id'));
  if (res.statusCode != 200) throw Exception('fail');
  return User.fromJson(jsonDecode(res.body));
}

// Stream — 매 multiple async value
Stream<int> count(int n) async* {
  for (var i = 0; i < n; i++) {
    await Future.delayed(const Duration(seconds: 1));
    yield i;
  }
}

Isolate (compute)

import 'dart:isolate';

Future<int> heavyCompute(List<int> data) =>
  Isolate.run(() => data.fold(0, (a, b) => a + b * b));

// 매 main isolate 의 block 없이 background work
final sum = await heavyCompute(List.generate(1_000_000, (i) => i));

Extension methods

extension StringX on String {
  String get capitalized => isEmpty ? this : '${this[0].toUpperCase()}${substring(1)}';
}

print('hello'.capitalized); // "Hello"

Mixin

mixin Loggable {
  void log(String msg) => print('[${runtimeType}] $msg');
}

class Service with Loggable {
  void doWork() => log('working...');
}

매 결정 기준

상황 Approach
매 Flutter mobile/desktop app Dart (의무)
매 CLI tool (cross-platform) Dart AOT compile
매 backend (Aqueduct/Shelf) 매 가능 — 매 ecosystem 작음
매 web (no Flutter) 매 비추천 — TS/JS 우세

기본값: 매 Flutter context 에서만 Dart 의 사용 — 매 standalone 은 Go/Rust/TS 의 권장.

🔗 Graph

🤖 LLM 활용

언제: 매 Flutter widget tree 작성, 매 isolate 기반 background work, 매 records/patterns 활용 의 modern Dart. 언제 X: 매 Flutter 외부 — 매 다른 ecosystem 에서 Dart 의 사용 의 의미 X.

안티패턴

  • 매 dynamic 의 남용: 매 type system 의 우회 — 매 sound null safety 의 무력화.
  • 매 sync await chain: 매 Future.wait 의 미사용 — 매 serialized 대기.
  • 매 isolate 와 closure: 매 capture-by-reference 의 함정 (sendable 만 가능).
  • 매 print debug: 매 debugPrint / logger 의 권장.

🧪 검증 / 중복

  • Verified (dart.dev language tour, Dart 3.3 release 2024, Flutter 3.27).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — Dart 3 records/patterns/sealed 정리