stub
This commit is contained in:
26
cmd/app/main.dart
Normal file
26
cmd/app/main.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:location/location.dart';
|
||||
|
||||
Location location = Location();
|
||||
location.enableBackgroundMode(enable: true)
|
||||
|
||||
bool serviceEnabled;
|
||||
PermissionStatus permissionGranted;
|
||||
LocationData locationData;
|
||||
|
||||
serviceEnabled = await location.serviceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
serviceEnabled = await location.requestService();
|
||||
if (!serviceEnabled) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
permissionGranted = await location.hasPermission();
|
||||
if (permissionGranted == PermissionStatus.denied) {
|
||||
permissionGranted = await location.requestPermission();
|
||||
if (permissionGranted != PermissionStatus.granted) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
locationData = await location.getLocation();
|
||||
Reference in New Issue
Block a user