Home > Software design >  I am getting errors when trying to run flutter app. The parameter can't have a value of 'n
I am getting errors when trying to run flutter app. The parameter can't have a value of 'n

Time:11-17

This is the errors that I get please tell me what to do?

lib/models.dart:21:21: Error: The parameter 'description' can't have a value of 'null' because of its type
'String', but the implicit default value is 'null'. Try adding either an explicit non-'null' default value or the 'required' modifier. WeatherInfo({this.description, this.icon});

lib/models.dart:21:39: Error: The parameter 'icon' can't have a value of 'null' because of its type 'String',
but the implicit default value is 'null'. Try adding either an explicit non-'null' default value or the 'required' modifier. WeatherInfo({this.description, this.icon});

lib/models.dart:33:25: Error: The parameter 'temperature' can't have a value of 'null' because of its type
'double', but the implicit default value is 'null'. Try adding either an explicit non-'null' default value or the 'required' modifier. TemperatureInfo({this.temperature});

lib/models.dart:50:25: Error: The parameter 'cityName' can't have a value of 'null' because of its type
'String', but the implicit default value is 'null'. Try adding either an explicit non-'null' default value or the 'required' modifier. WeatherResponse({this.cityName, this.tempInfo, this.weatherInfo});

lib/models.dart:50:40: Error: The parameter 'tempInfo' can't have a value of 'null' because of its type
'TemperatureInfo', but the implicit default value is 'null'. 'TemperatureInfo' is from 'package:flutterapp/models.dart' ('lib/models.dart'). Try adding either an explicit non-'null' default value or the 'required' modifier. WeatherResponse({this.cityName, this.tempInfo, this.weatherInfo});

lib/models.dart:50:55: Error: The parameter 'weatherInfo' can't have a value of 'null' because of its type
'WeatherInfo', but the implicit default value is 'null'. 'WeatherInfo' is from 'package:flutterapp/models.dart' ('lib/models.dart'). Try adding either an explicit non-'null' default value or the 'required' modifier. WeatherResponse({this.cityName, this.tempInfo, this.weatherInfo});

lib/main.dart:19:19: Error: Field '_response' should be initialized because its type 'WeatherResponse' doesn't allow null. 'WeatherResponse' is from 'package:flutterapp/models.dart' ('lib/models.dart'). WeatherResponse _response;

CodePudding user response:

I can't help you if you don't send the code, you have to send it instead of the entire debug log.

Press Ctrl k to enter code in your ask

CodePudding user response:

This is the line with error.

  WeatherResponse _response;

Non-nullable instance field '_response' must be initialized.

  • Related