Skip to content

[Generator] Imports in generated code conflict with common entity class names #519

@Asperson

Description

@Asperson

In my app I have entity named Condition and objectbox generator generates objectbox.g.dart with follow error:

The name 'Condition' is defined in the libraries 'package:myapp/model/condition.dart' and 'package:objectbox/src/native/query/query.dart'.

I wasn't able to find a way (like generator option) to resole that error other than rename my entity

Basic info:

  • ObjectBox and ObjectBox generator version: 1.7.2
  • Flutter/Dart SDK: 3.7.7
  • Null-safety enabled: yes
  • Reproducibility: always
  • OS: Windows 11
  • Device/Emulator: Windows

Steps to reproduce

  1. In new flutter project create new entity class named Condition with just id field
  2. Run generator with command flutter pub run build_runner build --delete-conflicting-outputs
  3. If you excluded generated files in analysis_options.yaml you need to compile it to see error, otherwise you will see it right there.

Expected behavior

code generation without errors

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions