Search code examples
flutterdartgeneratorcamelcasingobjectbox

Flutter - Objectbox generation additional options for non CamelCase


When I run the generator in flutter, it will generate my objectbox.g.dart file as expected and works fine but I get 100's of lint warnings

Name non-constant identifiers using lowerCamelCase.

I don't have my properties set with camel case, So I have properties like CustomerID, Billing_Address1 etc.

In my model files I have

// ignore_for_file: non_constant_identifier_names

which stops the linting warnings. I prefer this style for models.

I want the generated file to also have this added when rebuilt. It already adds

// ignore_for_file: camel_case_types

So my question is how can I default this also?

Thanks


Solution

  • Just add analysis_options.yaml to your project, e.g. with the following contents:

    linter:
      rules:
        non_constant_identifier_names: false
    

    or

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