TraccarApiService class

Constructors

TraccarApiService({AuthManager? authManager, HttpClientConfig? httpConfig, WebSocketConfig? webSocketConfig})
Creates an instance of TraccarApiService

Properties

cacheManager → CacheManager
Get cache manager instance
no setter
currentUsername → String?
Gets current username
no setter
deviceUpdatesStream → Stream<List<Device>>
Stream of real-time device updates
no setter
eventUpdatesStream → Stream<List<Event>>
Stream of real-time event updates
no setter
hashCode → int
The hash code for this object.
no setterinherited
isAuthenticated → bool
Checks if user is currently authenticated
no setter
isWebSocketConnected → bool
Gets WebSocket connection status
no setter
positionUpdatesStream → Stream<List<Position>>
Stream of real-time position updates
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
webSocketStatusStream → Stream<WebSocketStatus>
Stream of WebSocket connection status changes
no setter

Methods

clearCache() → Future<void>
Clear all cached API responses
connectWebSocket() → Future<bool>
Connects to WebSocket for real-time updates Returns true if connection is successful
disconnectWebSocket() → Future<void>
Disconnects from WebSocket
dispose() → void
Disposes of all resources including WebSocket connections
flushAllBatches() → Future<void>
Flush all pending batches
getBatchingStats() → BatchStats?
Get batch statistics
getCacheStats() → Future<CacheStats>
Get cache statistics
getDevice(int deviceId) → Future<Device?>
Gets a specific device by ID
getDevices() → Future<List<Device>>
Gets all devices
getDevicesBatched() → Future<List<Device>>
Get devices using batched request (if batching is enabled)
getDistanceReports({required List<int> deviceIds, required DateTime from, required DateTime to}) → Future<List<ReportDistance>>
Gets distance reports
getDrivers() → Future<List<Driver>>
Gets all drivers
getEvents({List<int>? deviceIds, DateTime? from, DateTime? to, List<String>? types}) → Future<List<Event>>
Gets events
getGeofences() → Future<List<Geofence>>
Gets all geofences
getMaintenances() → Future<List<Maintenance>>
Gets all maintenance records
getPositions({List<int>? deviceIds, DateTime? from, DateTime? to}) → Future<List<Position>>
Gets positions for devices
getPositionsBatched({List<int>? deviceIds, DateTime? from, DateTime? to}) → Future<List<Position>>
Get positions using batched request (if batching is enabled)
getRateLimitStatus() → RateLimitStatus?
Get current rate limit status
getSession() → Future<Session?>
Gets current session information
getStopsReports({required List<int> deviceIds, required DateTime from, required DateTime to}) → Future<List<StopsReport>>
Gets stops reports
getSummaryReports({required List<int> deviceIds, required DateTime from, required DateTime to}) → Future<List<ReportSummary>>
Gets summary reports
getTripReports({required List<int> deviceIds, required DateTime from, required DateTime to}) → Future<List<Trips>>
Gets trip reports
hasCachedCredentials() → Future<bool>
Checks if credentials are cached
initialize() → Future<void>
Initializes the service by loading cached credentials
invalidateCache(String endpoint) → Future<void>
Invalidate cache for specific endpoint
invalidateDeviceCache() → Future<void>
Invalidate device-related cache
invalidateGeofenceCache() → Future<void>
Invalidate geofence-related cache
invalidatePositionCache() → Future<void>
Invalidate position-related cache
login({required String username, required String password, required String serverUrl}) → Future<bool>
Logs in with username, password, and server URL Caches credentials on successful login
logout() → Future<void>
Logs out and clears cached credentials
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refreshAuth() → Future<bool>
Refreshes authentication state
resetRateLimit() → void
Reset rate limiter
sendCommand(Command command) → Future<bool>
Sends a command to a device
toString() → String
A string representation of this object.
inherited

Operators

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