setSyncBodyBuilder method
- SyncBodyBuilder? builder
override
Sets a callback to build custom HTTP sync body.
When set, this callback is invoked before each sync request. The returned Map is used as the HTTP request body instead of the default location array format.
Example:
Locus.setSyncBodyBuilder((locations, extras) async {
return {
'ownerId': extras['ownerId'],
'polygons': locations.map((l) => l.coords.toJson()).toList(),
};
});
Implementation
@override
void setSyncBodyBuilder(SyncBodyBuilder? builder) {
_methodCalls.add('setSyncBodyBuilder');
_syncBodyBuilder = builder;
}