- 資料夾和檔案名稱
使用小寫英數字加底線,例如:models\customer_model.dart - Class 類別名稱
使用 Upper Camel Case 大駝峰式命名,例如:class CustomerModel - 分辨 public 和 private
類別的屬性和方法名稱若有底線,則代表 private,反之則為 public,例如:class _CustomerModel
(Dart 沒有 public 和 private 關鍵字) - 變數和函數名稱
使用 Lower Camel Case 小駝峰式命名,例如:int customerId = -1; - 建立新物件時可省略 new 這關鍵字
例如:return new CustomerModel(); 可以寫成 return CustomerModel();
Dart 程式語言命名原則


Leave a comment