init method

void init(
  1. List<String?>? atsignsToTrackFromApp, {
  2. LatLng? etaFrom,
  3. bool? calculateETA,
  4. bool? addCurrentUserMarker,
  5. String? textForCenter,
  6. Function? showToast,
  7. String? notificationID,
  8. DateTime? refreshAt,
})

/ the centre LatLng is getting added more than once

Implementation

void init(
  List<String?>? atsignsToTrackFromApp, {
  LatLng? etaFrom,
  bool? calculateETA,
  bool? addCurrentUserMarker,
  String? textForCenter,
  Function? showToast,
  String? notificationID,
  DateTime? refreshAt,
}) async {
  hybridUsersList = [];
  centreMarker = null;
  _atHybridUsersController = StreamController<List<HybridModel?>>.broadcast();
  atsignsToTrack = atsignsToTrackFromApp;
  this.etaFrom = etaFrom;
  this.calculateETA = calculateETA;
  this.addCurrentUserMarker = addCurrentUserMarker;
  this.textForCenter = textForCenter;
  this.showToast = showToast;
  this.notificationID = notificationID;
  this.refreshAt = refreshAt;

  // ignore: unawaited_futures
  if (myLocationStream != null) myLocationStream!.cancel();

  if (etaFrom != null) addCentreMarker();
  await addMyDetailsToHybridUsersList();

  updateHybridList();

  uniqueID = DateTime.now().millisecondsSinceEpoch.toString();
  refreshUpdateHybridList(uniqueID);
}