toSyncMap property

Map<String, dynamic> Function(dynamic model)? toSyncMap
final

Optional custom function to serialize objects before sending to server.

If not provided, uses generated toEJson() from .realm.dart files. Use this when you need computed fields or custom transformations.

Example:

toSyncMap: (obj) => {
  '_id': obj.id,
  'displayName': '${obj.firstName} ${obj.lastName}',
  'timestamp': obj.createdAt.toIso8601String(),
}

Implementation

final Map<String, dynamic> Function(dynamic model)? toSyncMap;