Skip to content

@Index doesn't work for getter/setter properties #528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
23doors opened this issue Apr 5, 2023 · 1 comment
Closed

@Index doesn't work for getter/setter properties #528

23doors opened this issue Apr 5, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@23doors
Copy link

23doors commented Apr 5, 2023

Basic info (please complete the following information):

  • ObjectBox version: 2.0.0
  • Flutter/Dart SDK: [e.g. 2.0.0, or the output of dart --version or flutter --version]
  • Null-safety enabled: yes
  • Reproducibility: always

Steps to reproduce

Entity with:

  @Transient()
  DateTime? utcDate;

  @Index()
  int get dbUtcDate => utcDate?.millisecondsSinceEpoch ?? 0;

  set dbUtcDate(int value) {
    utcDate = DateTime.fromMillisecondsSinceEpoch(value, isUtc: true);
  }

generates objectbox-model.json without index:

        {
          "id": "46:2219823090073850885",
          "name": "dbUtcDate",
          "type": 6
        }

Expected behavior

Above should generate indexed property, just like this does (version without transient + getter/setter):

  @Index()
  int? dbUtcDate;

generates:

        {
          "id": "46:2219823090073850885",
          "name": "dbUtcDate",
          "type": 6,
          "flags": 8,
          "indexId": "35:4553977394910343818"
        }
@greenrobot-team
Copy link
Member

Thanks for reporting! Merging this with #392 (and closing this).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants