I am facing issue when I am using JsonSerialization on Objectobox Entity I tried to find better solution but I could not find
Asked
Active
Viewed 129 times
0
-
1Please provide more details, this question can‘t be answered with the provided info. – brance Nov 19 '22 at 08:37
-
We have a test that uses `json_serializable`, maybe that can help you get started: https://github.com/objectbox/objectbox-dart/blob/main/generator/integration-tests/part-partof/lib/json.dart – Uwe - ObjectBox Nov 21 '22 at 07:21
1 Answers
0
@JsonSerializable()
@Entity()
class ContactModel {
@Id()
int internalId;
@Index()
final String? id;
final String? userId;
final String? businessName;
final String? contactPersonName;
final String? contact;
final String? whatsappNumber;
final String? email;
final String? address;
final String? pinCode;
final String? city;
final String? businessType;
final String? description;
final String? img;
final String? lat;
final String? longitude;
final String? createDate;
final String? clientType;
ContactModel(
{this.internalId=0,
this.id,
this.userId,
this.businessName,
this.contactPersonName,
this.contact,
this.whatsappNumber,
this.email,
this.address,
this.city,
this.pinCode,
this.businessType,
this.description,
this.img,
this.lat,
this.longitude,
this.createDate,
this.clientType});
Map<String, dynamic> toMap(ContactModel contactModel) => _$ContactModelToJson(contactModel);
factory ContactModel.fromJson(Map<String, dynamic> json) => _$ContactModelFromJson(json);
}

ItsAnilg
- 1
- 3
-
1Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 24 '23 at 08:20