requestRepaint method

void requestRepaint()

Requests a repaint of the marker overlay.

This method should be called whenever the marker data changes in a way that affects the visual representation. It notifies the UI system that the markers need to be redrawn.

When to Call:

  • After adding, removing, or modifying markers
  • When marker visibility or filtering changes
  • After batch operations on markers
  • When marker data is loaded asynchronously

Performance Considerations:

  • Avoid calling this method excessively (e.g., in tight loops)
  • Batch multiple marker changes and call once at the end
  • The method is safe to call from any thread

Error Handling: The method gracefully handles cases where no listeners are registered or when the widget tree is being disposed.

// Single operation
datastore.addMarker(newMarker);
datastore.requestRepaint();

// Batch operations
datastore.addMarkers(newMarkers);
datastore.removeMarker(oldMarker);
datastore.requestRepaint(); // Single call for all changes

Implementation

void requestRepaint() {
  try {
    notifyListeners();
  } catch (error) {
    // Ignore errors that may occur during widget disposal
    // or when no listeners are registered
  }
}