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),
'avatar': serializer.toJson<String?>(avatar),
'name': serializer.toJson<String?>(name),
'members': serializer.toJson<String>(members),
'kindIndex': serializer.toJson<int>(kindIndex),
'isHidden': serializer.toJson<bool>(isHidden),
'muted': serializer.toJson<String?>(muted),
'directLink': serializer.toJson<String?>(directLink),
'createdAt': serializer.toJson<PreciseDateTime>(createdAt),
'updatedAt': serializer.toJson<PreciseDateTime>(updatedAt),
'lastReads': serializer.toJson<String>(lastReads),
'lastDelivery': serializer.toJson<PreciseDateTime?>(lastDelivery),
'firstItem': serializer.toJson<String?>(firstItem),
'lastItem': serializer.toJson<String?>(lastItem),
'lastReadItem': serializer.toJson<String?>(lastReadItem),
'unreadCount': serializer.toJson<int>(unreadCount),
'totalCount': serializer.toJson<int>(totalCount),
'ongoingCall': serializer.toJson<String?>(ongoingCall),
'favoritePosition': serializer.toJson<double?>(favoritePosition),
'membersCount': serializer.toJson<int>(membersCount),
'ver': serializer.toJson<String>(ver),
'lastItemCursor': serializer.toJson<String?>(lastItemCursor),
'lastReadItemCursor': serializer.toJson<String?>(lastReadItemCursor),
'recentCursor': serializer.toJson<String?>(recentCursor),
'favoriteCursor': serializer.toJson<String?>(favoriteCursor),
};
}