![](/img/trans.png)
[英]How can I solve the problem with the build runner: "This requires the 'non-nullable' language feature to be enabled."?
[英]build_runner: This requires the language feature to be enabled
當我將 build_runner 用於freezed 、 json_serializable 、 auto_route並在同一文件中使用新的 dart 語言功能(如超參數或增強枚舉)時,我總是會收到代碼生成錯誤:
*_page.dart:11:11: This requires the 'enhanced-enums' language feature to be enabled.
您必須使用根項目文件夾中的build.yaml文件來啟用語言功能:
<project_root>
│
├── pubspec.yaml
│
└── build.yaml <----
build.yaml
targets:
$default:
builders:
json_serializable|json_serializable:
options:
super-parameters: true
enhanced-enums: true
freezed|freezed:
options:
super-parameters: true
enhanced-enums: true
auto_route|auto_route:
options:
super-parameters: true
enhanced-enums: true
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.