Link class

Link to a resource, either relative to a Publication or external (remote).

See https://readium.org/webpub-manifest/schema/link.schema.json

Implemented types
Available extensions
Annotations

Constructors

Link({required String href, String? id, bool templated = false, String? type, String? title, List<String> rels = const [], Properties properties = const Properties(), int? height, int? width, double? bitrate, double? duration, List<String> languages = const [], List<Link> alternates = const [], List<Link> children = const []})
const

Properties

alternates List<Link>
Alternate resources for the linked resource.
final
bitrate double?
(Nullable) Bitrate of the linked resource in kbps.
final
children List<Link>
Resources that are children of the linked resource, in the context of a given collection role.
final
duration double?
(Nullable) Length of the linked resource in seconds.
final
elementId String?
no setter
hashCode int
The hash code for this object.
no setterinherited
height int?
(Nullable) Height of the linked resource in pixels.
final
href String
URI or URI template of the linked resource.
final
hrefPart String
no setter
id String?
(Nullable) Unique identifier for this link in the Publication.
final
languages List<String>
Expected language of the linked resource.
final
mediaType MediaType
Media type of the linked resource.
no setter
properties Properties
Properties associated to the linked resource.
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
rels List<String>
Relations between the linked resource and its containing collection.
final
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
templated bool
Indicates that a URI template is used in href.
final
templateParameters List<String>
List of URI template parameter keys, if the Link is templated.
no setter
title String?
(Nullable) Title of the linked resource.
final
type String?
(Nullable) MIME type of the linked resource.
final
width int?
(Nullable) Width of the linked resource in pixels.
final

Methods

copyWith({String? id, String? href, bool? templated, String? type, String? title, List<String>? rels, Properties? properties, int? height, int? width, double? bitrate, double? duration, List<String>? languages, List<Link>? alternates, List<Link>? children}) Link
copyWithProperties(Properties properties) Link
Makes a copy of this Link after merging in the given additional other properties.
expandTemplate(Map<String, String> parameters) Link
Expands the HREF by replacing URI template variables by the given parameters.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes a Link to its RWPM JSON representation.
override
toLocator() Locator

Available on Link, provided by the LinkLocator extension

Creates a Locator from a reading order Link.
toString() String
A string representation of this object.
override
toUrl(String? baseUrl) String?
Computes an absolute URL to the link, relative to the given baseUrl.

Operators

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

Static Methods

fromJson(Map<String, dynamic>? json) Link?
Creates an Link from its RWPM JSON representation. If the link can't be parsed, a warning will be logged.
fromJsonArray(List? json) List<Link>
Creates a list of Link from its RWPM JSON representation. If a link can't be parsed, a warning will be logged.