LibraryMirror findLibrary(Symbol libraryName)

Returns the unique library named libraryName if it exists.

If no unique library exists, an error is thrown.

Source

LibraryMirror findLibrary(Symbol libraryName) {
  return libraries.values.singleWhere(
      (library) => library.simpleName == libraryName);
}