小部件库NoSuchMethodError捕获异常

时间:2020-05-06 20:26:54

标签: android ios api flutter dart

════════小部件库捕获到异常══════════════════════════════════ ═════════════════════ 在构建Builder时引发了以下NoSuchMethodError: 方法'[]'在null上被调用。 接收者:null 尝试致电:

相关的引起错误的小部件是: MaterialApp文件:/// C:/Users/Ahmed/AndroidStudioProjects/weather_app/lib/main.dart:9:12 引发异常时,这是堆栈:

0 Object.noSuchMethod(dart:core-patch / object_patch.dart:53:5)

1 _LocationScreenState.UpdateUI。 (程序包:weatherapp / screens / location_screen.dart:27:38)

2 State.setState(package:flutter / src / widgets / framework.dart:1148:30)

3 _LocationScreenState.UpdateUI(程序包:weatherapp / screens / location_screen.dart:26:5)

4 _LocationScreenState.initState(程序包:weatherapp / screens / location_screen.dart:23:1)

在#1

df['mean'] = df[fiveyear].sum(1, min_count=len(fiveyear))/len(fiveyear)

在#4

`void UpdateUI(dynamic weatherdata){
    setState(() {
    double temp = weatherdata['main']['temp'];
    temperature  = temp.toInt();
    var condition = weatherdata['weather'][0]['id'];
    weatherIcon = weather.getWeatherIcon(condition);
    weatherDescription = weather.getMessage(temperature);
    cityname  = weatherdata['name'];
    });
  }`

我正尝试从下面的此API链接获取数据 https://samples.openweathermap.org/data/2.5/weather?lat=35&lon=139&appid=50228b366a46bef0c96ee6e6cecd4b6a

0 个答案:

没有答案