get method

Location get(
  1. String name
)

Finds Location by its name.

Implementation

Location get(String name) {
  if (!isInitialized) {
    // Before you can get a location, you need to manually initialize the
    // timezone location database by calling initializeDatabase or similar.
    throw LocationNotFoundException(
        'Tried to get location before initializing timezone database');
  }

  final loc = _locations[name];
  if (loc == null) {
    throw LocationNotFoundException(
        'Location with the name "$name" doesn\'t exist');
  }
  return loc;
}