android – Unawaited error in flutter with http package deal – Stack Overflow


 
import 'package deal:weather_app/fashions/constants.dart';
import 'package deal:weather_app/fashions/climate.dart';
import 'package deal:http/http.dart' as http;

dynamic weatherData(String location) async {
    var url = Uri.parse(searchWeatherAPI(key: Constants.API_KEY) + location);

    var response = await http.get(url); // that is line 30

    if (response.statusCode == 200) {
      Checklist<Climate> weatherData = weatherFromJson("[${response.body}]");
      return weatherData;
    } else {
      print(response.physique);
      return response.physique;
    }
  }

when i run this code the app crashed and present me browser_client.dart
and this error apear in debug console

ChromeProxyService: Failed to judge expression 'see': InternalError: Expression analysis in async frames shouldn't be supported. No body with index 30..

ChromeProxyService: Failed to judge expression 'solely': InternalError: Expression analysis in async frames shouldn't be supported. No body with index 30..

ChromeProxyService: Failed to judge expression 'unawaited': InternalError: Expression analysis in async frames shouldn't be supported. No body with index 30..

ChromeProxyService: Failed to judge expression 'the': InternalError: Expression analysis in async frames shouldn't be supported. No body with index 30..

i am tried to make use of

attempt{}catch(e){}

however error nonetheless occur

my api should get metropolis or nation title and if exist return its climate knowledge and if not exist return “No matching location discovered.” and that i’ll make person insert this nation or metropolis title and should return message for him if exist or not

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles