Kruzr360Communicator class

Main communicator class for interacting with the Kruzr 360 SDK.

This class provides a comprehensive interface for all Kruzr 360 SDK functionality including user management, trip monitoring, metrics collection, Bluetooth device management, and data synchronization.

Usage:

final communicator = Kruzr360Communicator(
  companyName: 'your-company-name',
  accountName: 'your-account-name',
);

Constructors

Kruzr360Communicator({required String companyName, required String accountName})
Creates a new instance of Kruzr360Communicator.
const

Properties

accountName String
The account name identifier for this SDK instance.
final
companyName String
The company name identifier for this SDK instance.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bluetoothScanEventStream() EventChannel
Provides an event stream for Bluetooth device scanning updates.
checkPermission(KruzrPermission kruzrPermission) Future<bool>
Checks if a specific permission has been granted.
editSavedVehicle(NearbyDevice nearbyDevice) → void
enableWifiOnlyDataSyncPref(bool wifiOnly) Future<void>
ensurePermissionOrOpenSettings(KruzrPermission kruzrPermission) Future<bool>
Ensures a permission is granted through a comprehensive flow.
fetchAvailableRewards() Future<List<AvailableReward>>
Retrieves all rewards available in the Kruzr rewards catalog.
fetchEarnedRewards() Future<List<EarnedReward>>
Retrieves all rewards that the current user has successfully earned or claimed.
fetchMyAchievements() Future<MyAchievements?>
Retrieves the user's achievements across all categories.
fetchRoute(String appTripId) Future<GeoJSONFeatureCollection?>
Retrieves the full GeoJSON route for a given trip.
fetchTripDetailsByAppTripId(String appTripId) Future<SingleTripResponse?>
Retrieves detailed information for a specific trip using its app trip ID.
fetchTripInsights(String appTripId) Future<TripInsights?>
Retrieves comprehensive insights for a specific trip.
fetchTripList(int offset, int length) Future<List<SingleTripResponse>>
fetchTripStatsByAppTripId(String appTripId) Future<TripStatsResponse?>
Retrieves statistical analysis for a specific trip.
fetchUserProfileTierRequirements() Future<List<UserProfileTierRequirement>>
Retrieves all available user profile tiers along with their eligibility requirements.
generateShareableURL(String appTripId) Future<ShareableTripUrlResponseModel?>
Generates a shareable URL for a specific trip.
getAggregatedDistanceTravelled(DateTime startTime, DateTime endTime, KruzrPerioicType kruzrPerioicType) Future<KruzrHistoricDoubleDataResponse?>
Retrieves aggregated distance travelled data for a specified time period.
getAggregatedDriveTimeInSeconds(DateTime startTime, DateTime endTime, KruzrPerioicType kruzrPerioicType) Future<KruzrHistoricDoubleDataResponse?>
Retrieves aggregated drive time data in seconds for a specified period.
getAggregatedDrivingBehaviourScore(DateTime startTime, DateTime endTime, KruzrPerioicType kruzrPerioicType) Future<DrivingBehaviourScore?>
Retrieves detailed driving behavior scores broken down by category.
getAggregatedDrivingBehaviourScoreChange(KruzrPerioicType kruzrPeriodicType) Future<DrivingBehaviourScoreChange?>
Retrieves the change in driving behavior scores over a specified period.
getAggregatedDrivingScore(DateTime startTime, DateTime endTime, KruzrPerioicType kruzrPerioicType) Future<KruzrHistoricDoubleDataResponse?>
Retrieves aggregated driving score data for a specified time period.
getAllPairedDevices() Future<List<NearbyDevice>>
getAllSavedVehicles() Future<List<NearbyDevice>>
Retrieves all vehicles that have been saved by the user.
getAutoTripStartOnlyIfVehicleConnected() Future<bool>
Retrieves the current automatic trip start only if vehicle connected setting.
getConnectedDevices() Future<List<NearbyDevice>>
getCurrentTripData() Future<CurrentTripDataResponse?>
Retrieves data for the currently active trip.
getCurrentUserRank() Future<UserRank?>
Retrieves the current user's rank in the leaderboard system.
getDrivingSummary(DateTime startTime, DateTime endTime, KruzrPerioicType kruzrPerioicType) Future<DrivingSummary?>
Retrieves comprehensive driving summary for a specified time period.
getLeaderboardTop10() Future<List<LeaderBoardDriver>>
Retrieves the top 10 drivers from the leaderboard.
getPendingFilesCount() Future<num?>
Retrieves the number of files pending synchronization.
getPendingFilesSize() Future<num?>
Retrieves the total size of files pending synchronization.
getPlatformVersion() Future<String?>
Retrieves the platform version information from the native SDK.
getPossibleInterventionsForAppTripId(String appTripId) Future<List<PossibleIntervention>>
Retrieves possible intervention events that occurred during a specific trip.
getTripAutoEndEnabled() Future<bool>
Retrieves the current automatic trip end setting.
getTripAutoStartEnabled() Future<bool>
Retrieves the current automatic trip start setting.
getUserStreak() Future<UserStreak?>
Retrieves the current user's driving streak information.
initiateTripMonitoring() Future<void>
Initiates trip monitoring functionality in the Kruzr SDK.
isCurrentDataSyncPrefWifiOnly() Future<bool>
isEventSyncRealTimeEnabled() Future<bool>
Retrieves the current real-time event synchronization setting.
isLoggedIn() Future<bool>
Checks if a user is currently logged in to the Kruzr system.
leaderboard(int offset, int length) Future<List<LeaderBoardDriver>>
Retrieves a paginated list of drivers from the leaderboard.
logout() Future<void>
Logs out the current user from the Kruzr system.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openSettings() Future<void>
Opens the device's application settings page.
refreshFileSyncStatus() Future<void>
Refreshes the file synchronization status from the server.
registerUserToKruzr({required String driverId, String? name, String? countryCode, String? phoneNumber, String? email, String? dateOfBirth, String? referralCode}) Future<int>
Registers a new user with the Kruzr platform.
removeAllSavedVehicles() → void
Deletes all saved vehicle associations from the device.
removeSavedVehicle(NearbyDevice nd) → void
Removes a specific saved vehicle from the user's vehicle list.
requestPermission(KruzrPermission kruzrPermission) Future<bool>
Requests a specific permission from the user.
saveVehicle(NearbyDevice nearbyDevice) → void
Saves a nearby Bluetooth device as a known vehicle for future automatic detection.
scanForNearbyDevices() Future<List<NearbyDevice>>
Starts scanning for nearby Bluetooth devices.
setAutoTripStartOnlyIfVehicleConnected(bool shouldAutoStartOnlyIfVehicleConnected) Future<void>
Enables or disables automatic trip start only if vehicle is connected.
setTripAutoEndEnabled(bool shouldAutoEnd) Future<void>
Enables or disables automatic trip end detection.
setTripAutoStartEnabled(bool shouldAutoStart) Future<void>
Enables or disables automatic trip start detection.
setupLocationStuffs() → void
Sets up location-related components and permissions for the SDK.
shareTrip(String appTripId, String countryCOde, String phoneNUmber) Future<ShareTripResponse?>
shouldEventSyncRealTime(bool allowEventSyncRealTime) Future<void>
Enables or disables real-time event synchronization.
startTrip() Future<bool>
Manually starts a new trip.
stopScanningForNearbyDevices() Future<void>
stopTrip() Future<bool>
Manually stops the current active trip.
syncTripData() Future<void>
Synchronizes local trip data with Kruzr servers.
toString() String
A string representation of this object.
inherited
userDetails() Future<RegisteredDriver?>
Retrieves detailed information about the currently logged-in user.

Operators

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

Static Methods

initializeSDK(Kruzr360InitConfig kruzr360InitConfig) Future<void>
Initializes the Kruzr 360 SDK with the provided configuration.