toggleWeatherOverlay method
//////////// ////////////
Implementation
// II.G - UI State Management
///////////////
void toggleWeatherOverlay() async {
debugPrint("[DEBUG] Weather overlay toggled: Visible = $_weatherVisible at ${DateTime.now()}");
if (_mapboxMap == null) {
debugPrint("[DEBUG] Cannot toggle weather overlay: mapboxMap is null");
return;
}
try {
if (_weatherVisible) {
debugPrint("[DEBUG] Removing weather layers...");
await _removeWeatherLayers();
debugPrint("[DEBUG] Weather layers successfully removed");
} else {
debugPrint("[DEBUG] Adding weather layers...");
await _addWeatherLayers();
debugPrint("[DEBUG] Weather layers successfully added");
}
_weatherVisible = !_weatherVisible;
debugPrint("[DEBUG] Weather overlay visibility updated to: $_weatherVisible");
notifyListeners();
debugPrint("[DEBUG] Notified listeners of weather overlay change");
} catch (e) {
debugPrint("[DEBUG] Error toggling weather overlay: $e");
_showError('Unable to toggle weather overlay');
}
}