Problem Loading Custom Style on iOS with maplibre_gl #561
-
Hello, I am experiencing an issue with the Flutter package maplibre_gl. On Android, my custom style loads correctly from a local style.json file. However, on iOS, the same file does not load, and the map displays the default MapLibreStyles.demo style. Details:
The style is then applied as follows:
My json file:
Observations:
Steps taken to resolve the issue:
Despite these efforts, the issue persist and I am not sure on the solution. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I finally found the cause of my problem. According to the package documentation, in the Map Styles section (see point 4), it is specified that it is only possible to provide the JSON content in raw form (in a String) on Android. In my code, I was using:
This modification solves the problem of displaying the style on iOS, which previously displayed the default style. |
Beta Was this translation helpful? Give feedback.
I finally found the cause of my problem. According to the package documentation, in the Map Styles section (see point 4), it is specified that it is only possible to provide the JSON content in raw form (in a String) on Android. In my code, I was using:
rootBundle.loadString(...)
to retrieve the style, which worked on Android but was problematic on iOS. So I realized that it wasn't necessary to wait for the style to be loaded in raw form for iOS. The solution is simply to specify the asset path directly in thestyleString
parameter, as follows:This modification solves the problem of displaying the…