toJson method
- ValueSerializer? serializer,
override
Converts this object into a representation that can be encoded with
json
. The serializer
can be used to configure how individual values
will be encoded. By default, DriftRuntimeOptions.defaultSerializer will
be used. See ValueSerializer.defaults for details.
Implementation
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'num': serializer.toJson<String>(num),
'name': serializer.toJson<String?>(name),
'bio': serializer.toJson<String?>(bio),
'avatar': serializer.toJson<String?>(avatar),
'callCover': serializer.toJson<String?>(callCover),
'mutualContactsCount': serializer.toJson<int>(mutualContactsCount),
'online': serializer.toJson<bool>(online),
'presenceIndex': serializer.toJson<int?>(presenceIndex),
'status': serializer.toJson<String?>(status),
'isDeleted': serializer.toJson<bool>(isDeleted),
'dialog': serializer.toJson<String?>(dialog),
'isBlocked': serializer.toJson<String?>(isBlocked),
'lastSeenAt': serializer.toJson<PreciseDateTime?>(lastSeenAt),
'contacts': serializer.toJson<String>(contacts),
'ver': serializer.toJson<String>(ver),
'blockedVer': serializer.toJson<String>(blockedVer),
'welcomeMessage': serializer.toJson<String?>(welcomeMessage),
};
}