Publication class

The Publication shared model is the entry-point for all the metadata and services related to a Readium publication.

@param manifest The manifest holding the publication metadata extracted from the publication file. @param fetcher The underlying fetcher used to read publication resources. The default implementation returns Resource.Exception.NotFound for all HREFs. @param servicesBuilder Holds the list of service factories used to create the instances of Publication.Service attached to this Publication. @param positionsFactory Factory used to build lazily the positions.

Available Extensions

Constructors

Publication({required Manifest manifest, Fetcher fetcher = const EmptyFetcher(), ServicesBuilder? servicesBuilder, Map<ReadiumCSSName, bool> userSettingsUIPreset = const {}, String? cssStyle})

Properties

baseUrl Uri?
The URL where this publication is served, computed from the Link with self relation.
no setter
context List<String>
no setter
Finds the first Link to the publication's cover (rel = cover).
no setter
cssStyle String?
getter/setter pair
fetcher Fetcher
final
hashCode int
The hash code for this object.
no setterinherited
jsonManifest String
Returns the RWPM JSON representation for this Publication's manifest, as a string.
no setter
no setter
manifest Manifest
final
metadata Metadata
no setter
nbPages int
getter/setter pair
paginationInfo Map<Link, LinkPagination>
getter/setter pair
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
readingOrder List<Link>
Identifies a list of resources in reading order for the publication.
no setter
resources List<Link>
Identifies resources that are necessary for rendering the publication.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
subcollections Map<String, List<PublicationCollection>>
no setter
tableOfContents List<Link>
Identifies the collection that contains a table of contents.
no setter
type TYPE
getter/setter pair
userSettingsUIPreset Map<ReadiumCSSName, bool>
getter/setter pair

Methods

close() → void
Closes any opened resource associated with the Publication, including services.
findService<T extends PublicationService>() → T?
Returns the first publication service that is an instance of Type.
findServices<T extends PublicationService>() Iterable<T>
Returns all the publication services that are instances of Type.
get(Link link) Resource
Returns the resource targeted by the given non-templated link.
linksWithRel(String rel) List<Link>
Finds all Links having the given rel in the publications's links.
linksWithRole(String role) List<Link>
Returns the links of the first child PublicationCollection with the given role, or an empty list.
linkWithHref(String href) Link?
Finds the first Link with the given HREF in the publication's links.
linkWithRel(String rel) Link?
Finds the first Link having the given rel in the publications's links.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resourceWithHref(String href) Link?
Finds the first resource Link (asset or readingOrder item) at the given relative path.
Sets the URL where this Publication's RWPM manifest is served.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

localBaseUrlOf(String filename, int port) String
Creates the base URL for a Publication locally served through HTTP, from the publication's filename and the HTTP server port.
localUrlOf(String filename, int port, String href) String
Gets the absolute URL of a resource locally served through HTTP.