objectbox / objectbox-dart

Flutter database for super-fast Dart object persistence
https://docs.objectbox.io/getting-started
Apache License 2.0
927 stars 115 forks source link

Make meta properties accessible via static methods from the entity instance #562

Open leslmosnk opened 7 months ago

leslmosnk commented 7 months ago

static mebers can be called from an instance of class with ObjectBox queries.

greenrobot-team commented 7 months ago

Thanks! However, I don't really see why this is needed. Can you explain how this is useful to you?

leslmosnk commented 7 months ago

Thanks! However, I don't really see why this is needed. Can you explain how this is useful to you?

This way I managed to extend Object with Object_. So I can easily call a query parameter from an instance of Object.

(I later found out export 'objectbox.g.dart' show Object_ is enough for my purposes)

greenrobot-team commented 7 months ago

But why can't the Object_ fields be used in your case? We chose explicitly not to add them to the model class to keep it clean (e.g. to avoid any conflicts with existing code).

leslmosnk commented 7 months ago

Its very possible to use Object_, but I feel like it only used whenever I also use my Object. So i'd rather have a static in Object that would hold my queries instead of having to import and call Object_ every time.