Flutter - The getter 'length' was called on null

In our case, we got this error when Internet Connection is off after calling webservice.


First one check spieler_namen is null or not.If it is null then use below code i hope this will solve your problem.....

if(spieler_namen == null){
  new Container(width: 10.0,height:  10.0,);
 }else{
 your requirement .......
 }

We spend lost's of time to resolve issue finally we got a solution is: Please check you pubspec.yaml and remove extra '-' in case of assets file and also please follow the structure of that like spacing and all that.

We are must sure that issue only in pubspec.yaml file


punkteanzahl_teamEins is only declared. But not initialized. So it is throwing null error.

You should assign value to punkteanzahl_teamEins as

List<int> punkteanzahl_teamEins = [1,4,5,7];

or pass data from parent as requirement.