import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:shared_preferences/shared_preferences.dart'; LatLng? latlong; getLocation() async { LocationPermission permission = await Geolocator.checkPermission(); if (permission == LocationPermission.denied || permission == LocationPermission.deniedForever) { permission = await Geolocator.requestPermission(); // } else { Position currentP = await Geolocator.getCurrentPosition( desiredAccuracy: LocationAccuracy.best); latlong = LatLng(currentP.latitude, currentP.longitude); } else { // Position currentP = await Geolocator.getCurrentPosition( // desiredAccuracy: LocationAccuracy.best); // latlong = LatLng(prefs.getDouble('lat')!, prefs.getDouble('long')!); Position currentP = await Geolocator.getCurrentPosition( desiredAccuracy: LocationAccuracy.best); latlong = LatLng(currentP.latitude, currentP.longitude); } print(latlong); print('done'); } setname() async { SharedPreferences prefs = await SharedPreferences.getInstance(); String? token = prefs.getString('token'); if (token != null) { // await ProfileAPI().getApi(); // prefs.setString('email', getProfileObj!.data!.email!); // prefs.setString('profile_img', getProfileObj!.data!.profilePhoto!); // prefs.setString('firstName', getProfileObj!.data!.firstName!); // prefs.setString('phoneNo', getProfileObj!.data!.phoneNo ?? ""); // prefs.setInt('complete', getProfileObj!.data!.profileComplete ?? 0); } }