non_const_generative_enum_constructor工具 chevron_right診斷 chevron_rightnon_const_generative_enum_constructor 目錄描述示例常見修復生成式列舉建構函式必須是 'const'。描述#當列舉宣告包含未標記為 const 的生成式建構函式時,分析器會產生此診斷。示例#以下程式碼會產生此診斷,因為 E 中的建構函式未被標記為 constdartenum E { e; E(); }常見修復#在建構函式前新增 const 關鍵字dartenum E { e; const E(); }此頁面內容有幫助嗎?thumb_up thumb_down感謝您的反饋! feedback 提供詳細資訊感謝您的反饋!請告訴我們如何改進。 bug_report 提供詳細資訊除非另有說明,本網站文件反映 Dart 3.8.1。頁面最後更新於 2025-05-08。 檢視原始碼 或 報告問題。