ข้ามไปยังเนื้อหา

Tooling, Testing & Production

การเขียน widget เป็นแค่ครึ่งเดียวของงาน อีกครึ่งคือเครื่องมือรอบ ๆ code ของคุณ: toolchain ที่รัน code ของคุณ, test ที่พิสูจน์ว่าทำงาน, build mode ที่แปลง Dart เป็น native binary ที่เร็ว และเรื่อง production ที่ตัดสินว่า user จริงจะมีวันที่ดีหรือไม่

โมดูลนี้คือครึ่งหลังนั้น — ส่วนที่แยก demo ออกจาก product

บทเรียนสิ่งที่คุณจะได้เรียน
Project & toolingpubspec.yaml, flutter CLI, DevTools และ hot reload vs hot restart
Testingunit, widget, integration และ golden test
Build & releasedebug/profile/release mode, JIT vs AOT, flavor, output แต่ละ platform
Production concernserror handling, crash reporting, profiling และ CI/CD
flowchart LR
  dev["develop
(hot reload)"] --> test["test
(unit/widget/golden)"]
  test --> build["build
(release, AOT)"]
  build --> ship["ship
(monitor, profile, CI/CD)"]
Flutter delivery workflow

แต่ละ stage มีเครื่องมือของตัวเองและ failure mode ของตัวเอง เส้นเรื่องหลัก: Flutter optimize หนักมากเพื่อ inner loop ที่เร็ว (hot reload) แล้วสลับไปใช้ compilation strategy คนละแบบเลย (AOT) ตอน release — เข้าใจการแยกนี้แล้วจะเข้าใจ tooling เกือบทั้งหมด

โมดูลนี้โฟกัสที่อะไร?
ทำไม "ทำงานได้ใน debug" ถึงไม่การันตี "ทำงานได้ใน release"?
inner development loop ของ Flutter ถูก optimize เพื่ออะไร?