populateLocation method

void populateLocation(
  1. Location? location
)

Populate the locationDateIdMap with a new location if it does not exist.

Implementation

void populateLocation(Location? location) {
  // If the location is null, use the default location.
  final locationString = location?.name ?? defaultLocation;

  // Add the location if it does not exist.
  if (!hasDateToEventIds(locationString)) locationDateIdMap[locationString] = DateToEventIds();

  // Add all existing events to the new location.
  for (final event in idEvent.values) {
    addEventToLocation(location, event);
  }
}