entity toMap() will missing some key like: "page" or "id"
Closed this issue · 1 comments
sidiaoling commented
this is my request entity:
class SomeReqEntity with SomeEntityMappable {
@MappableField(key: 'user_id')
int? userId;
int page = 1;
String? sort;
int? id;
SomeReqEntity();
factory SomeReqEntity.fromMap(Map<String, dynamic> map) =>
SomeReqEntityMapper.fromMap(map);
factory SomeReqEntity.fromJson(String json) =>
SomeReqEntityMapper.fromJson(json);
static SomeReqEntityMapper ensureInitialized() =>
SomeReqEntityMapper.ensureInitialized();
}
when i give the value with id, page, userid,and use SomeReqEntity.toMap(),id and page key will missing
when i use @MappableField(key: 'id'), @MappableField(key: 'page'), every thing is fine.
schultek commented
Please check the docs for this: https://pub.dev/documentation/dart_mappable/latest/topics/Models-topic.html#utilizing-constructors