flutterdata / flutter_data

Seamlessly manage persistent data in your Flutter apps
MIT License
410 stars 31 forks source link

DataModel as mixin #222

Closed andreacioni closed 1 year ago

andreacioni commented 1 year ago

Hi everyone,

I was wondering if there is a way to let flutter_data work with model that are defined in some other packages. I've imagined something like that:

class A extends B with DataModel<A>

where B is model defined in another package. But since DataModel is a class and not a mixin that simply can't work.

I tried to find similar issues here on GitHub but the only referring to this argument was #165 . Was DataModelMixin introduced? Maybe with a different name?

damienkaliop commented 1 year ago

I'm interested too because I'm stuck in the same issue with generated models from GraphQL

frank06 commented 1 year ago

Try out that commit and let me know if it helps.

andreacioni commented 1 year ago

Hi @frank06 ,

just tried the new version (1.5.12) with the mixin and I can confirm that is seems to work reliably.

Great work and many thanks!