We are currently on the Team Plan and our project name is TD God-View. We integrated the flutter plugin for our product which is a Logistics App.
We have observed some inconsistency in the behaviour of the plugin which we would like to clarify for trips.
- When we started a trip we noticed the trip did not have the userId field set even though we could see from the logs that we were setting this value
- Trip was not updated even after calling start trip, we could not see the trip on the radar dashboard.
- At some point, after recalling the start trip function pertaining to our use case, we would get the results on radar sometimes in a perfect manner and sometimes we get it inconsistently.
Our implementation
We initialised the plugin on the main method, which was verified because the plugin logged the radar initialise method on the console.
await Radar.initialize(environment['RADAR_PUBLISHABLE_KEY']!);
The plugin logged this:
I/RadarLogger(21315): :round_pushpin:️ Radar initialized
After initialising the plugin we set the user ID and the user description immediately after the user logged in following the documentation procedure which states that the function is meant to be called only once. And we also verified the plugin stored the data by calling the getUserId function on the plugin.
static Future<void> initRadar(BuildContext context) async{
/// [TdUser] details
String userId = context.read<LoginProvider>().currentUser!.id!;
String displayName = context.read<LoginProvider>().currentUser!.displayName;
/// [logger]
log('');
log('---------------- RADAR INITIALIZED ----------------');
log('::::: UserId: $userId :::::');
log('::::: Display Name: $displayName :::::');
log('');
/// Setting user's Description
await Radar.setUserId(userId);
await Radar.setDescription(displayName);
await Radar.startTracking('continuous');
log('Radar tracking');
}
This was logged immediately this method was called:
[log] ---------------- RADAR INITIALIZED ----------------
[log] ::::: UserId: Eds4G5HD2AypMeBPD :::::
[log] ::::: Display Name: Babalola Gbogo :::::
This was logged after a little while
[log] Radar tracking
Then we proceeded to starting a trip in which sometimes it won’t start and sometimes it will.
static Future<void> startTrip({
required BuildContext context,
}) async {
final Stop _firstStop = context
.read<TripProvider>()
.stops!
.where((_stop) => _stop.position == 1)
.toList()
.first;
final String externalId =
'${_firstStop.deliveryTripId}_${_firstStop.stopId}';
final outlet = await _getRetailOutlet(
context,
_firstStop,
);
/// [logger]
log('');
log('---------------- START TRIP ----------------');
log('::::: First Stop: ${_firstStop.retailOutletName} :::::');
log('::::: Outlet Type: ${outletMapper(
outlet: outlet!.outletType,
)} :::::');
log('');
/// Starting trip with radar
await _startRadarTrip(
externalId: externalId,
outletType: outletMapper(
outlet: outlet.outletType,
),
outletId: outlet.retailOutletId!,
);
log('Trip Started');
}
We verified that it called these methods using the log output
[log] ---------------- START TRIP ----------------
[log] ::::: First Stop: Liquid metal :::::
[log] ::::: Outlet Type: large-super-market :::::
And then after a little delay this got logged
[log] Trip Started