title: Flutter how to get latitude, longitude using geolocator package?
body: <blockquote>
  <p>Flutter how to get latitude, longitude using geolocator package?
  Already gave permissions both android and ios, downloaded package using pubspec.yaml. I don't understand why can't print longitude and latitude to console? tried write print(position), print(position.longitude()), print(position.latitue()).</p>
  </blockquote>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:geolocator/geolocator.dart';
  
  
  class LoadingScreen extends StatefulWidget {
   @override
   _LoadingScreenState createState() =&gt; _LoadingScreenState();
  }
  
  class _LoadingScreenState extends State&lt;LoadingScreen&gt; {
   void getLocation() async {
     print('Printing text before getCurrentLocation()');
     Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
     print(position);
  
  
  }
  
   @override
   Widget build(BuildContext context) {
     return Scaffold(
       body: Center(
         child: RaisedButton(
           color: Colors.red,
           onPressed: () {
             getLocation();
           },
           child: Text('Get Location'),
         ),
       ),
     );
   }
  } ```
  </code></pre>