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.
-
ensurePermission(
KruzrPermission kruzrPermission) → Future< bool> - Ensures a permission is granted through a comprehensive flow.
-
fetchTripInsights(
String appTripId) → Future< TripInsights?> - Retrieves comprehensive insights for a specific trip.
-
getAchievements(
) → Future< MyAchievements?> - Retrieves the user's achievements across all categories.
-
getAggregatedDistance(
DateTime startTime, DateTime endTime, KruzrPerioicType kruzrPerioicType) → Future< KruzrHistoricDoubleDataResponse?> - Retrieves aggregated distance travelled data for a specified time period.
-
getAggregatedDriveTime(
DateTime startTime, DateTime endTime, KruzrPerioicType kruzrPerioicType) → Future< KruzrHistoricDoubleDataResponse?> - Retrieves aggregated drive time data in seconds for a specified period.
-
getAggregatedDrivingScore(
DateTime startTime, DateTime endTime, KruzrPerioicType kruzrPerioicType) → Future< KruzrHistoricDoubleDataResponse?> - Retrieves aggregated driving score data for a specified time period.
-
getAutoTripStartOnlyIfVehicleConnected(
) → Future< bool> - Retrieves the current automatic trip start only if vehicle connected setting.
-
getAvailableRewards(
) → Future< List< AvailableReward> > - Retrieves all rewards available in the Kruzr rewards catalog.
-
getConnectedDevices(
) → Future< List< Vehicle> > -
getDrivingBehaviourScore(
DateTime startTime, DateTime endTime, KruzrPerioicType kruzrPerioicType) → Future< DrivingBehaviourScore?> - Retrieves detailed driving behavior scores broken down by category.
-
getDrivingBehaviourScoreChange(
KruzrPerioicType kruzrPeriodicType) → Future< DrivingBehaviourScoreChange?> - Retrieves the change in driving behavior scores over a specified period.
-
getDrivingSummary(
DateTime startTime, DateTime endTime, KruzrPerioicType kruzrPerioicType) → Future< DrivingSummary?> - Retrieves comprehensive driving summary for a specified time period.
-
getEarnedRewards(
) → Future< List< EarnedReward> > - Retrieves all rewards that the current user has successfully earned or claimed.
-
getLeaderboard(
int offset, int length) → Future< List< LeaderBoardDriver> > - Retrieves a paginated list of drivers from the getLeaderboard.
-
getLeaderboardTop10(
) → Future< List< LeaderBoardDriver> > - Retrieves the top 10 drivers from the getLeaderboard.
-
getOngoingTrip(
) → Future< CurrentTripDataResponse?> - Retrieves data for the currently active trip.
-
getPairedDevices(
) → Future< List< Vehicle> > -
getPendingSyncCount(
) → Future< num?> - Retrieves the number of files pending synchronization.
-
getPendingSyncSize(
) → Future< num?> - Retrieves the total size of files pending synchronization.
-
getPlatformVersion(
) → Future< String?> - Retrieves the platform version information from the native SDK.
-
getSavedVehicles(
) → Future< List< Vehicle> > - Retrieves all vehicles that have been saved by the user.
-
getTripDetails(
String appTripId) → Future< SingleTripResponse?> - Retrieves detailed information for a specific trip using its app trip ID.
-
getTripInterventions(
String appTripId) → Future< List< PossibleIntervention> > - Retrieves possible intervention events that occurred during a specific trip.
-
getTripList(
int offset, int length) → Future< List< SingleTripResponse> > -
getTripRoute(
String appTripId) → Future< GeoJSONFeatureCollection?> - Retrieves the full GeoJSON route for a given trip.
- Generates a shareable URL for a specific trip.
-
getTripStats(
String appTripId) → Future< TripStatsResponse?> - Retrieves statistical analysis for a specific trip.
-
getUserDetails(
) → Future< RegisteredDriver?> - Retrieves detailed information about the currently logged-in user.
-
getUserRank(
) → Future< UserRank?> - Retrieves the current user's rank in the getLeaderboard system.
-
getUserStreak(
) → Future< UserStreak?> - Retrieves the current user's driving streak information.
-
getUserTierRequirements(
) → Future< List< UserProfileTierRequirement> > - Retrieves all available user profile tiers along with their eligibility requirements.
-
initiateTripMonitoring(
) → Future< void> - Initiates trip monitoring functionality in the Kruzr SDK.
-
isLoggedIn(
) → Future< bool> - Checks if a user is currently logged in to the Kruzr system.
-
isRealTimeEventSyncEnabled(
) → Future< bool> - Retrieves the current real-time event synchronization setting.
-
isTripAutoEndEnabled(
) → Future< bool> - Retrieves the current automatic trip end setting.
-
isTripAutoStartEnabled(
) → Future< bool> - Retrieves the current automatic trip start setting.
-
isWifiOnlySyncEnabled(
) → Future< bool> -
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.
-
refreshSyncStatus(
) → Future< void> - Refreshes the file synchronization status from the server.
-
registerUser(
{required String driverId, String? name, String? countryCode, String? phoneNumber, String? email, String? dateOfBirth, String? referralCode}) → Future< String> - Registers a new user with the Kruzr platform.
-
removeAllVehicles(
) → void - Deletes all saved vehicle associations from the device.
-
removeVehicle(
Vehicle 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(
Vehicle vehicle) → void - Saves a nearby Bluetooth device as a known vehicle for future automatic detection.
-
setAutoTripStartOnlyIfVehicleConnected(
bool shouldAutoStartOnlyIfVehicleConnected) → Future< void> - Enables or disables automatic trip start only if vehicle is connected.
-
setRealTimeEventSync(
bool allowEventSyncRealTime) → Future< void> - Enables or disables real-time event synchronization.
-
setTripAutoEnd(
bool shouldAutoEnd) → Future< void> - Enables or disables automatic trip end detection.
-
setTripAutoStart(
bool shouldAutoStart) → Future< void> - Enables or disables automatic trip start detection.
-
setupLocation(
) → void - Sets up location-related components and permissions for the SDK.
-
setWifiOnlySync(
bool wifiOnly) → Future< void> -
startBluetoothScan(
) → Future< List< Vehicle> > - Starts scanning for nearby Bluetooth devices.
-
startTrip(
) → Future< bool> - Manually starts a new trip.
-
stopBluetoothScan(
) → 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
-
updateVehicle(
Vehicle vehicle) → void
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.