Closed MauroGentile closed 5 months ago
@MauroGentile did you find a solution to this? I am facing the same issue. I have the example running fine but can't get it to run in my project.
I tried updating the mapbox js version and stopped getting this error:
<!-- Mapbox -->
<script src='https://api.mapbox.com/mapbox-gl-js/v2.8.2/mapbox-gl.js'></script>
Your string in the HTM is correct. I have the following.
<script src='https://api.mapbox.com/mapbox-gl-js/v2.7.0/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v2.7.0/mapbox-gl.css' rel='stylesheet' />
</body>
The error in my case is that I was using the wrong StyleID.
Use this:
TileLayer(urlTemplate: StyleId),
where StyleId has a format like:
'https://api.mapbox.com/styles/v1/userName/yyyyyy?access_token=pk.xxxxx'
Let me know if this solves
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I had that as well in a couple of instances and was able to debug it in the web inspect console or the Xcode runtime for anyone else coming across this.
Thiis probably due to me not setting up correctly mapbox for flutter.
1) I created an access token with donwloads:read permission AT is something like sk.XXXXX 2) In web/imdex.html I have added the following 2 lines
3) I have a widget like:
child: MapboxMap( accessToken: <accesstoken>, styleString: 'mapbox://styles/mapbox/streets-v11', // You can change the map style here onMapCreated: (controller) { setState(() { _controller = controller; }); },
When I run this widget i get TypeError: Cannot set properties of undefined (setting 'accessToken')