
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.
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
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!