I have created a map with simple Topographic basemap and have OAuth set up (I can verify that it works correctly). Also, I don't set 'ArcGISEnvironment.apiKey' variable.
I expect that auth challenge is raised and basemap is loaded after that. Nevertheless, I get the following error in console:
flutter: [E] 22:25:29.502337 Unhandled Loadable ArcGISMap load error: ArcGISException: code=22; HttpException: Failed to parse header value
If I set apiKey, everything works well.
This can be reproduced using Authenticate with OAuth sample. Just remove apiKey in 'main.dart' and change 'onMapViewReady()' function to the following:
void onMapViewReady() {
final map = ArcGISMap.withBasemapStyle(BasemapStyle.arcGISTopographic);
// Set the map to map view controller.
_mapViewController.arcGISMap = map;
}
Could you please clarify how can I use OAuth only (without API key) for loading basemap?
I am checking via iPhone 15 simulator w/ iOS 17.5. Haven't tried on Android ones.
ArcGIS Flutter SDK version is 200.6.
Solved! Go to Solution.
The "Failed to parse header value" exception is caused by a bug in Dart. That bug has been fixed, and the fix will be included in the next major release of Flutter (which will have Dart version 3.8). The bug is written up here: https://github.com/dart-lang/sdk/issues/46442
Until that fix lands, the workaround is to create a webmap with the desired basemap. Loading a portal item with OAuth works as intended, so that is a general solution to avoiding the "Failed to parse header value" problem.
The "Failed to parse header value" exception is caused by a bug in Dart. That bug has been fixed, and the fix will be included in the next major release of Flutter (which will have Dart version 3.8). The bug is written up here: https://github.com/dart-lang/sdk/issues/46442
Until that fix lands, the workaround is to create a webmap with the desired basemap. Loading a portal item with OAuth works as intended, so that is a general solution to avoiding the "Failed to parse header value" problem.
Thanks! Waiting on newest Flutter!