Flutter_map: Another exception was thrown: NoSuchMethodError: The getter 'iterator' was called on null.

Created on 3 Jan 2019  路  6Comments  路  Source: fleaflet/flutter_map

screenshot_20190103-025142

I am trying to launch the map just with center position and tiles. I get this error. Can someone help to fix it please?
I'm using the version 0.4.0 of flutter_map and also the stable version 1.0.0 of Flutter.

bug

Most helpful comment

No. There was no indication. But it's okay now, I found the problem and fixed it. The problem was that I didn't initialized marker and polyline arrays before using them for the first time on the map.
Thanks!

All 6 comments

In the run log of whichever IDE you use, does it reference a file and line number, that could help indicate which part of the code is null ?

No. There was no indication. But it's okay now, I found the problem and fixed it. The problem was that I didn't initialized marker and polyline arrays before using them for the first time on the map.
Thanks!

How to Make the flutter logs more verbose and improve console for logging ?

Good catch - the map should initialize the arrays if they aren't provided

Or at least the log should explain a little bit better that the error is caused by a null variable or badly asigned. I just found this issue because I had the same error and couldn't find what it was. In the end it was because I had a markers array and a function to build this array. The thing is that I was doing "markers = _buildMarkers()" but that function wasn't returning anything so the empty array was being overriden by a null value. Maybe some type checking before iteration in the Markers Layer would throw a more clear error.

there markers layer now sets the default value to an empty list

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abhijithvijayan picture abhijithvijayan  路  4Comments

vinicentus picture vinicentus  路  3Comments

zozeei picture zozeei  路  4Comments

rktvsiim picture rktvsiim  路  5Comments

SamuelRioTz picture SamuelRioTz  路  4Comments