addMyDetailsToHybridUsersList method
Adds the current user's details to the hybridUsersList
Implementation
Future addMyDetailsToHybridUsersList() async {
var permission = await Geolocator.checkPermission();
if (((permission == LocationPermission.always) ||
(permission == LocationPermission.whileInUse))) {
var _atsign = AtLocationNotificationListener().currentAtSign;
var mylatlng = await getMyLocation();
var _image = await MasterLocationService().getImageOfAtsignNew(_atsign);
var _myData = HybridModel(
displayName: _atsign, latLng: mylatlng, eta: '?', image: _image);
updateMyLatLng(_myData);
myLocationStream = Geolocator.getPositionStream(
locationSettings: const LocationSettings(distanceFilter: 10))
.listen((myLocation) async {
var mylatlng = LatLng(myLocation.latitude, myLocation.longitude);
_myData = HybridModel(
displayName: _atsign, latLng: mylatlng, eta: '?', image: _image);
updateMyLatLng(_myData);
});
} else {
// ignore: unnecessary_null_comparison
if (AtLocationNotificationListener().navKey != null) {
CustomToast().show('Location permission not granted',
AtLocationNotificationListener().navKey.currentContext!,
isError: true);
}
}
}