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
In 1.x, sending a parent record that contains fully embedded child objects (rather than just foreign-key IDs) automatically persisted those children, so BelongsTo.value / HasMany.value were immediately available.
In 2.x, the same payload only saves the parent; the relationships remain null (or empty) until I manually insert the children. Is this the intended behaviour, or is there a recommended way to restore automatic persistence of embedded resources?
When we query the restaurant model, the primaryCurrency is available, but when we then set the restaurant in a ValueNotifier, it loses the relationships
Code:
@JsonSerializable()
@DataAdapter([BaseAdapter, RestaurantAdapter])
class Restaurant extends DataModel<Restaurant> {
final int? id;
@JsonKey(name: 'primary_currency')
final BelongsTo<Currency> primaryCurrency;
@JsonKey(name: 'staffs')
final HasMany<Staff> staffs;
}
class Currency extends DataModel<Currency> {
@override
final int? id;
final String name;
final String code;
Currency({
this.id,
required this.name,
required this.code,
});
}
Activity