You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
As an alternative to inheritance, there might be fields that I would like to share between different unrelated models.
A use case for this could be audit fields that standardizes the format of when a record was created or updated.
By supporting interfaces, we would enable multiple definitions of standardized fields that could be added to a model.
Describe the solution you'd like
Add a new model type called interface that can be implemented by other models.
The definition for an Interface could look like this:
It would be great if this would also allow the user to implement a Dart class interface - this would allow the user to use the objects which are passed over the wire in more scenarios without the need to map them into an object which would ducktype to the same fields.
p.s.
The current PR already adds a great feature even without allowing to specify the exact position of the interface fields.
Another nice feature that extends on the above is to allow the use of the same interface more than once in the same table. This would require specifying a fields name prefix for each use.
Activity
BenAuerDev commentedon Jan 24, 2025
I'll look into this :) 🚀
vlidholt commentedon Jan 24, 2025
@BenAuerDev, this is awesome! 🥳
dkbast commentedon May 21, 2025
It would be great if this would also allow the user to implement a Dart class interface - this would allow the user to use the objects which are passed over the wire in more scenarios without the need to map them into an object which would ducktype to the same fields.
borutjures commentedon Aug 26, 2025
It would be nice to be able to determine where the interface fields are inserted in the database table.
p.s.
The current PR already adds a great feature even without allowing to specify the exact position of the interface fields.
Another nice feature that extends on the above is to allow the use of the same interface more than once in the same table. This would require specifying a fields name prefix for each use.
In the above example the fields prefix would be determined by removing the interface name (
_homeAddressInterface).