Flutter - 非 CamelCase 的 Objectbox 生成附加选项

问题描述

当我在 Flutter 中运行生成器时,它会按预期生成我的 objectBox.g.dart 文件并且工作正常,但我收到了 100 条 lint 警告

使用lowerCamelCase命名非常量标识符。

我的属性没有设置驼峰式大小写,所以我有 CustomerID、Billing_Address1 等属性

在我的模型文件

// ignore_for_file: non_constant_identifier_names

停止 linting 警告。我更喜欢模特的这种风格。

我希望生成文件在重建时也添加这个。已经添加

// ignore_for_file:camel_case_types

所以我的问题是我如何也认这个?

谢谢

解决方法

只需将 analysis_options.yaml 添加到您的项目中,例如内容如下:

linter:
  rules:
    non_constant_identifier_names: false

analyzer:
  exclude:
    - lib/objectbox.g.dart