LibraryMirror findLibrary(
Symbol libraryName
)

Returns the unique library named libraryName if it exists.

If no unique library exists, an error is thrown.

Source

/**
 * Returns the unique library named [libraryName] if it exists.
 *
 * If no unique library exists, an error is thrown.
 */
LibraryMirror findLibrary(Symbol libraryName) {
  return libraries.values.singleWhere(
      (library) => library.simpleName == libraryName);
}