Closed themak01 closed 3 years ago
Getting this error after when i updated my android studio and emulator initially it was working
CODE
import 'package:geolocator/geolocator.dart'; class Location { late double latitude; late double longitude; Future <void> getCurrentLocation() async{ try { Position position = await Geolocator.getCurrentPosition( desiredAccuracy: LocationAccuracy.low); latitude = position.latitude; longitude = position.longitude; }catch(e){ print(e); } } } //Main.dart import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:weather_app/services/location.dart'; import 'package:http/http.dart' as http; class LoadingScreen extends StatefulWidget { @override _LoadingScreenState createState() => _LoadingScreenState(); } class _LoadingScreenState extends State<LoadingScreen> { @override void initState() { super.initState(); getLocation(); } getLocation() async { Location location = Location(); await location.getCurrentLocation(); print(location.latitude); print(location.longitude); } void getData() async { http.Response response = await http.get(Uri.parse( "http://api.openweathermap.org/data/2.5/weather?q=London&appid=bd247a015f492dc90288c1bb3d60c27e")); if(response.statusCode == 200){ String data = response.body; var longitude = jsonDecode(data)['coord']['lon']; print(longitude); }else{ print(response.statusCode); } } @override Widget build(BuildContext context) { getData(); return Scaffold(); } }
Thanks for the report; @themak01 - can you re-file this at flutter/flutter?
soo, this issue was closed with no solutions?
Getting this error after when i updated my android studio and emulator initially it was working
CODE