Discover how to effectively update markers on Google Maps in Flutter with simple steps and code snippets. --- This video is based on the question https://stackoverflow.com/q/74277313/ asked by the user 'AkashK' ( https://stackoverflow.com/u/7307010/ ) and on the answer https://stackoverflow.com/a/74277648/ provided by the user 'Aissam Amezaourou' ( https://stackoverflow.com/u/17822736/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions. Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: Google maps markers not updating in google_maps_flutter Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l... The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license. If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com. --- Resolving Google Maps Markers Not Updating in Google Maps Flutter When working with Google Maps in Flutter, developers may encounter issues when trying to update or refresh markers on the map. If you're currently facing issues with markers not being removed or updated in your google_maps_flutter application, you're not alone. In this guide, we will explore the problem and present a clear solution to help you manage your map markers effectively. The Problem: Markers Not Updating While developing a map application using Flutter and Google Maps, you might find yourself successfully displaying a list of markers. However, when you attempt to clear the existing markers from the map and add new ones, the previously added markers may persist. This behavior can create confusing user experiences as your users may see outdated or redundant markers, rather than just the intended ones. Key Symptoms of the Issue: New markers are added, but old markers remain visible. Using setState() doesn’t update the map as expected. The Solution: Using setState Effectively To tackle this issue, one effective approach is to ensure proper use of the setState() function. By encapsulating marker updates within setState(), you inform Flutter that the state of your widget has changed, prompting a rebuild of the widget tree, including the Google Map. Step-by-Step Solution: Identify Where to Apply setState(): You need to ensure that when you want to clear the existing markers or update the list, you're using setState() to wrap your changes. Sample Refined Code Snippet: Below is a code snippet illustrating how to correctly apply setState() when adding or updating markers on the Google Map. [[See Video to Reveal this Text or Code Snippet]] Important Considerations: State Management Library: If you're using GetX or any state management library, ensure that your observable variables are being updated properly. For instance, calling mapMarkers.refresh() may be necessary depending on the management strategy employed. Clearing Markers: Make sure to clear your marker list correctly (like mapMarkers.clear()) before adding new markers. This ensures you start with a clean slate. Conclusion Updating markers on Google Maps in Flutter need not be a hassle once you understand how setState() works in conjunction with your markers. By applying the approach we've discussed, you can effectively manage the state of markers in your Flutter application. Don't forget to test after implementing changes to ensure that everything functions as intended. For further assistance or to share your experiences regarding this topic, feel free to leave a comment below! Happy coding!