Geolocator position does not appear in the console and there is no errors also I have tried to get the longitude and latitude using position.longitude separately but nothing changes , the problem is with this line but I am not able to determine it : Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
and here is the code:
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
class LoadingScreen extends StatefulWidget {
@override
_LoadingScreenState createState() => _LoadingScreenState();
}
class _LoadingScreenState extends State<LoadingScreen> {
void getLocation() async{
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
print(position);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: RaisedButton(
onPressed: () {
getLocation();
// _determinePosition();
//Get the current location
},
child: Text('Get Location'),
),
),
);
}
}