addDetails method
returns new marker and eta
Implementation
Future<void> addDetails(HybridModel user, {int? index}) async {
try {
user.marker = buildMarker(user);
var _eta = await _calculateEta(user);
user.eta = _eta;
if ((index != null)) {
if ((index < hybridUsersList.length)) hybridUsersList[index] = user;
} else {
var _continue = true;
for (var hybridUser in hybridUsersList) {
if (hybridUser!.displayName == user.displayName) {
hybridUser = user;
_continue = false;
return;
}
}
if (_continue) {
hybridUsersList.add(user);
}
}
} catch (e) {
_logger.severe(e);
if (showToast != null) showToast!('Something went wrong', isError: true);
}
}