forId static method

CalendarSystem forId(
  1. String id
)

Fetches a calendar system by its unique identifier. This provides full round-tripping of a calendar system. It is not guaranteed that calling this method twice with the same identifier will return identical references, but the references objects will be equal.

  • id: The ID of the calendar system. This is case-sensitive.

Returns: The calendar system with the given id.

  • KeyNotFoundException: No calendar system for the specified ID can be found.
  • NotSupportedException: The calendar system with the specified ID is known, but not supported on this platform.

Implementation

static CalendarSystem forId(String id) {
  Preconditions.checkNotNull(id, 'id');
  CalendarSystem Function()? factory = _idToFactoryMap[id];
  if (factory == null) {
    throw ArgumentError('No calendar system for ID {id} exists');
  }
  return factory();
}