mapbox / mapbox-maps-flutter

Interactive, thoroughly customizable maps for Flutter powered by Mapbox Maps SDK
https://www.mapbox.com/mobile-maps-sdk
Other
274 stars 105 forks source link

Error using layers decode function #223

Closed bruferrari closed 4 months ago

bruferrari commented 1 year ago

Hi folks,

I'm facing an issue where I'm adding layers using some layers. I'm getting an error such as type '_Map<String, dynamic>' is not a subtype of type 'String' using await _controller?.style.addLayer(CircleLayer.decode(layer)); and also, other kinds of layers triggers the same error eventually.

The JSON structure is right below, also I believe that what is causing this issue is the expression on circle-color cause I've tried doing the same as the decode method does manually by doing (layer["paint"]["circle-color"] as List?)?.toRGBAInt() but received the same error unfortunately.

{
   "type":"circle",
   "paint":{
      "circle-color":hsla(49,
      95%,
      42%,
      0.3),
      "circle-radius":[
         "interpolate",
         [
            "linear"
         ],
         [
            "zoom"
         ],
         3,
         1,
         7,
         3,
         8,
         10,
         12,
         50
      ],
      "circle-opacity":0.5
   },
   "maxzoom":22,
   "minzoom":3,
   "id":"faa_stadiums",
   "title":"Stadiums",
   "source":"faa_airspace",
   "source-layer":"tiles.faa_stadiums",
   "thumbnail_url":"https":,
   "description":"This layer displays the corresponding radius of stadiums where flights would be restricted during Major League Baseball",
   "National Football League",
   "\nNCAA",
   "and motor speedway events.\n\nNote":"TFRs will also be in effect for these areas when events are active.\n"
}

What do I'm possibly doing wrong?

evil159 commented 10 months ago

Similar issue has been addressed in https://github.com/mapbox/mapbox-maps-flutter/pull/249, could you check if it fixes it for you?

evil159 commented 4 months ago

Closing as stale, likely this is addressed in #249