-
Notifications
You must be signed in to change notification settings - Fork 30
refactor: Add error handling and optimize marker/camera operations #251
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
base: main
Are you sure you want to change the base?
refactor: Add error handling and optimize marker/camera operations #251
Conversation
…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.
@berhili098 |
Hi @berhili098, thanks for your contribution! When it comes to the example application, we prioritize code readability over exhaustive error handling. Our main goal is to keep the code examples easy to read and quick to understand, rather than covering every possible error scenario. In many cases, the errors thrown by the SDK are theoretical and should not occur if the functions are used correctly. Additionally, if we were to introduce this level of error handling in the example app, it would need to be implemented consistently across all pages and not just the camera and marker pages. Also, when catching exceptions, the specific exception type should be specified in the catch block. While using our SDK, did you encounter a specific error scenario that you're trying to resolve with this PR? |
This pull request primarily focuses on enhancing error handling and code organization in the
example/lib/pages/camera.dart
andexample/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:
_startNavigation
,_stopNavigation
,dispose
, andcalculateFocusCenter
methods to handle potential errors and display appropriate messages. [1] [2] [3]addMarkerToMap
,_removeMarker
,clearMarkers
,_updateSelectedMarkerWithOptions
,_toggleCustomIcon
, anddispose
to ensure robust error messages are shown. [1] [2]Code Organization Improvements:
_moveCameraWithAnimation
to reduce code duplication and improve readability. [1] [2] [3] [4] [5] [6] [7] [8]_updateMarkerProperty
to streamline the code and reduce redundancy.These changes collectively enhance the robustness and maintainability of the codebase.