Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Add error handling and optimize marker/camera operations #251

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

berhili098
Copy link

@berhili098 berhili098 commented Jan 20, 2025

This pull request primarily focuses on enhancing error handling and code organization in the example/lib/pages/camera.dart and example/lib/pages/markers.dart files. The most important changes include adding try-catch blocks for error handling, refactoring camera movement logic into a helper method, and improving marker management.

Error Handling Enhancements:

  • Added try-catch blocks to the _startNavigation, _stopNavigation, dispose, and calculateFocusCenter methods to handle potential errors and display appropriate messages. [1] [2] [3]
  • Introduced error handling in marker management methods such as addMarkerToMap, _removeMarker, clearMarkers, _updateSelectedMarkerWithOptions, _toggleCustomIcon, and dispose to ensure robust error messages are shown. [1] [2]

Code Organization Improvements:

  • Refactored camera movement logic into a new helper method _moveCameraWithAnimation to reduce code duplication and improve readability. [1] [2] [3] [4] [5] [6] [7] [8]
  • Consolidated marker property updates into a single helper method _updateMarkerProperty to streamline the code and reduce redundancy.

These changes collectively enhance the robustness and maintainability of the codebase.

  • Tests pass
  • Appropriate changes to documentation are included in the PR

…mera and markers pages

- Improved error handling in navigation and marker operations, providing user feedback on failures.
- Refactored marker management methods to reduce code duplication and improve readability.
- Added try-catch blocks to handle potential exceptions during navigation and marker updates.
- Introduced a helper method for updating marker properties, streamlining the process of toggling visibility, draggable state, and other attributes.
- Ensured proper cleanup of resources during disposal to prevent memory leaks.

These changes enhance the robustness and maintainability of the camera and markers functionality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants