seedInterruptedTrack method

Track seedInterruptedTrack({
  1. String trackId = 'fake-interrupted-track',
  2. String? routeId,
  3. TrackingConfig config = const TrackingConfig(),
})

Seeds a resumable interrupted route to simulate process restoration.

Implementation

Track seedInterruptedTrack({
  String trackId = 'fake-interrupted-track',
  String? routeId,
  TrackingConfig config = const TrackingConfig(),
}) {
  final now = _clock().toUtc();
  final track = Track(
    id: trackId,
    userId: _owner.userId,
    organizationId: _owner.organizationId,
    routeId: routeId,
    status: TrackStatus.interrupted,
    startedAt: now.subtract(const Duration(minutes: 5)),
    pausedAt: now,
    totalDistanceMeters: 0,
    acceptedPointCount: 0,
    rejectedPointCount: 0,
    segmentCount: 1,
    nextSequence: 1,
    currentSegmentId: null,
    completionReason: 'process_terminated',
    config: config,
  );
  _tracks[trackId] = track;
  _points[trackId] = <TrackPoint>[];
  calls.add(FakeTrackingCall(
    'seedInterruptedTrack',
    <String, Object?>{'trackId': trackId},
  ));
  _publish();
  return track;
}