Starting using geolocation.
This commit is contained in:
parent
f5058c506a
commit
8c73ba088b
@ -6,13 +6,12 @@ part 'location.g.dart';
|
|||||||
@riverpod
|
@riverpod
|
||||||
class MyLocation extends _$MyLocation {
|
class MyLocation extends _$MyLocation {
|
||||||
|
|
||||||
MyLocation() {
|
Future<void> _detertimeLocation() async {
|
||||||
/*
|
|
||||||
bool serviceEnabled;
|
bool serviceEnabled;
|
||||||
LocationPermission permission;
|
LocationPermission permission;
|
||||||
|
|
||||||
// Test if location services are enabled.
|
// Test if location services are enabled.
|
||||||
serviceEnabled = Geolocator.isLocationServiceEnabled().then(onValue);
|
serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||||
if (!serviceEnabled) {
|
if (!serviceEnabled) {
|
||||||
// Location services are not enabled don't continue
|
// Location services are not enabled don't continue
|
||||||
// accessing the position and request users of the
|
// accessing the position and request users of the
|
||||||
@ -37,11 +36,13 @@ class MyLocation extends _$MyLocation {
|
|||||||
// Permissions are denied forever, handle appropriately.
|
// Permissions are denied forever, handle appropriately.
|
||||||
return Future.error(
|
return Future.error(
|
||||||
'Location permissions are permanently denied, we cannot request permissions.');
|
'Location permissions are permanently denied, we cannot request permissions.');
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Position> build() async{
|
Future<Position> build() async{
|
||||||
|
await _detertimeLocation();
|
||||||
|
|
||||||
Position l = Position(longitude: 0, latitude: 0,
|
Position l = Position(longitude: 0, latitude: 0,
|
||||||
timestamp: DateTime.timestamp(), accuracy: 0, altitude: 0,
|
timestamp: DateTime.timestamp(), accuracy: 0, altitude: 0,
|
||||||
altitudeAccuracy: 0, heading: 0, headingAccuracy: 0,
|
altitudeAccuracy: 0, heading: 0, headingAccuracy: 0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user