Get CLI
เป็นเครื่องมือที่ช่วยให้การพัฒนาแอปพลิเคชัน Flutter ด้วย GetX ง่ายขึ้น โดยสามารถสร้างโครงสร้างของโปรเจกต์, ควบคุมการทำงาน, และจัดการแพ็กเกจได้อย่างสะดวก
pub global activate get_cli
หลังจากติดตั้ง ให้เพิ่ม path ต่อไปนี้ลงใน
System PATH
:[FlutterSDKInstallDir]\bin\cache\dart-sdk\bin
flutter pub global activate get_cli
get create project
คำสั่งนี้จะสร้างโปรเจกต์โดยใช้ชื่อเดียวกับโฟลเดอร์ปัจจุบัน
get create project:my_project
หากชื่อมีช่องว่าง ให้ใช้เครื่องหมาย
""
เช่น:
get create project:"my cool project"
get init
get create page:home
คำสั่งนี้จะสร้าง
Controller
,View
, และBinding
สำหรับหน้าhome
get create screen:home
ใช้สำหรับโครงสร้าง CLEAN architecture (โดย Arktekko)
get create controller:dialogcontroller on home
GetX จะค้นหาโฟลเดอร์
home
และเพิ่ม Controller ลงไปที่นั่น
get create view:dialogview on home
GetX จะค้นหาโฟลเดอร์
home
และเพิ่ม View ลงไปที่นั่น
get create provider:user on home
ใช้สำหรับสร้าง Provider เพื่อจัดการข้อมูลในแอปพลิเคชัน
get generate locales assets/locales
GetX จะสร้างไฟล์ localization จากไฟล์ JSON ภายใน
assets/locales
get generate model on home with assets/models/user.json
GetX จะสร้าง class model จาก JSON และเพิ่มเข้าไปในโฟลเดอร์
home
get generate model on home with assets/models/user.json --skipProvider
get generate model on home from "https://api.github.com/users/CpdnCristiano"
get install camera
ติดตั้งแพ็กเกจ
camera
ในโปรเจกต์ปัจจุบัน
get install http path camera
ติดตั้งแพ็กเกจ
http
,path
, และcamera
get install path:1.6.4
ติดตั้ง
path
เวอร์ชัน1.6.4
get install flutter_launcher_icons --dev
ติดตั้ง
flutter_launcher_icons
เฉพาะในdev_dependencies
get remove http
ลบแพ็กเกจ
http
get remove http path
ลบแพ็กเกจ
http
และpath
get update
หรือ
get upgrade
get -v
หรือ
get -version
get help
แสดงรายการคำสั่งทั้งหมดที่สามารถใช้ได้ใน Get CLI
flutter run -d chrome --web-browser-flag "--disable-web-security"