You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
673 B
23 lines
673 B
import 'package:geolocator/geolocator.dart';
|
|
import 'package:tuple/tuple.dart';
|
|
|
|
class Location {
|
|
static Future<Tuple2<double, double>> getCurrentLocation() async {
|
|
LocationPermission permission;
|
|
permission = await Geolocator.checkPermission();
|
|
if (permission == LocationPermission.denied) {
|
|
permission = await Geolocator.requestPermission();
|
|
if (permission == LocationPermission.deniedForever) {
|
|
//faire l'interface graphique pour gérer ça
|
|
return Future.error('Location Not Available');
|
|
}
|
|
}
|
|
Position current = await Geolocator.getCurrentPosition();
|
|
return Tuple2(current.longitude,current.latitude);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|