Open noorbakerally opened 2 years ago
Unfortunately that is not supported, yet.
Any advice about which files to modify to implement this functionality?
@noorbakerally Ideally, you should first research if this is possible also in the Android/iOS Maplibre libraries. Since this is a cross-platform library, we should strive to implement new features on all 3 supported platforms. However, if you only feel comfortable implementing this for web, you could also contribute that and we see if someone else can implement it for the other platforms.
For web specifically, you would probably have to pass a transformRequest
to MapOptions here https://github.com/m0nac0/flutter-maplibre-gl/blob/c723434d635068157311eb47c26df3e0554ff894/maplibre_gl_web/lib/src/mapbox_web_gl_platform.dart#L69 You can look at the other parameters to see how they are being passed down within the library.
Regarding the transformRequest, I recommend you to look at the source code/docs of maplibre-gl-dart (or mapbox-gl-dart, where maplibre-gl-dart was forked from). The relevant docs from mapbox-gl-dart are here: https://pub.dev/documentation/mapbox_gl_dart/latest/mapboxgl/MapOptions/transformRequest.html I'm not sure, though, how easy it would be to pass a dart function in there. You might to experiment a bit with the Dart-JS interop...
@m0nac0 thanks for the advise, let me check that, we are building something quite complex with this library in flutter, so far, it has been great, only this bit is required now
@noorbakerally do you find any solution
@berkayoruc unfortunately no, we had to change much in our project to adapt, but the issue isn't with the Flutter library, the native libraries works differently
If you are looking to add custom headers to your requests, you can try the setHttpHeaders
method (a global level at the library level).
Any updates here? I'm looking to add Authorization headers to my requests, but it seems setHttpHeaders
doesn't work for updating headers throughout the lifecycle of the app.
From Mapbox documentation it seems any further changes to sessionConfiguration via setHttpHeaders
doesn't affect the current session: https://github.com/mapbox/mapbox-gl-native-ios/blob/c8917ac1ea2f9f45e9a5a0e3376314160d64d5f3/platform/darwin/src/MGLNetworkConfiguration.h#L58-L60
In the JavaScript Maplibre, it is possible to transforms request as described here, and shown below. Do we have this feature in this library?