updateSettings method
- LocationComponentSettings settings
Partially updates the configuration, modifying only explicitly provided fields in settings while preserving the rest.
Call getSettings to retrieve the full resulting configuration.
Note: If no LocationComponentSettings.locationPuck is specified and none has been configured yet, Mapbox's built-in default puck is shown.
Implementation
Future<void> updateSettings(LocationComponentSettings settings) async {
// Omitting locationPuck leaves the current puck untouched, meaning after
// update puck is at its previous value or platform default if no puck has
// been set yet.
final useDefaultPuck2D = settings.locationPuck == null ||
settings.locationPuck?.locationPuck2D is DefaultLocationPuck2D;
settings.locationPuck?.locationPuck3D?.modelUri =
await MapboxMapsOptions._getFlutterAssetPath(
settings.locationPuck?.locationPuck3D?.modelUri,
);
await _api.updateSettings(settings, useDefaultPuck2D);
}