SyncBodyContext class

Context passed to a custom sync body builder callback.

Contains the locations about to be synced. The builder returns a Map<String, Object?> that becomes the full HTTP request body, giving integrators full control over the JSON structure.

Tracelet.setSyncBodyBuilder((context) {
  return {
    'deviceId': myDeviceId,
    'taskId': currentTaskId,
    'points': context.locations,
    'sentAt': DateTime.now().toIso8601String(),
  };
});
Annotations

Constructors

SyncBodyContext({required List<Map<String, Object?>> locations})
Creates a new SyncBodyContext.
const
SyncBodyContext.fromMap(Map<String, Object?> map)
Creates a SyncBodyContext from a map.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
locations List<Map<String, Object?>>
The location maps about to be synced.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, Object?>
Serializes to a map.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited