SnifferContext class
A companion type of Format.Sniffer
holding the type hints (file extensions, media types) and
providing an access to the file content.
@param mediaTypes Media type hints. @param fileExtensions File extension hints.
Constructors
-
SnifferContext({SnifferContent? content, List<
String> mediaTypes = const [], List<String> fileExtensions = const []})
Properties
- charset → String?
-
Finds the first Charset declared in the media types'
charset
parameter.no setter - content → SnifferContent?
-
final
-
fileExtensions
→ List<
String> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- loadedContentAsArchive ↔ bool
-
getter/setter pair
- loadedContentAsXml ↔ bool
-
getter/setter pair
-
mediaTypes
→ List<
MediaType> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
archiveEntriesAllSatisfy(
bool predicate(ArchiveEntry)) → Future< bool> -
Returns whether all the Archive entry paths satisfy the given
predicate
. -
containsArchiveEntryAt(
String path) → Future< bool> - Returns whether an Archive entry exists in this file.
-
containsJsonKeys(
List< String> keys) → Future<bool> - Returns whether the content is a JSON object containing all of the given root keys.
-
contentAsArchive(
) → Future< Archive?> - Content as an Archive instance. Warning: Archive is only supported for a local file, for now.
-
contentAsJson(
) → Future< Map< String, dynamic> ?> - Content parsed from JSON.
-
contentAsRwpm(
) → Future< Manifest?> - Readium Web Publication Manifest parsed from the content. */
-
contentAsString(
) → Future< String?> - Content as plain text.
-
contentAsXml(
) → Future< XmlElement?> - Content as an XML document.
-
hasAnyOfMediaTypes(
List< String> mediaTypesList) → bool - Returns whether this context has any of the given media type, ignoring case and extra parameters.
-
hasFileExtension(
List< String> fileExtensions) → bool - Returns whether this context has any of the given file extensions, ignoring case. */
-
hasMediaType(
String mediaType) → bool - Returns whether this context has the given media type, ignoring case and extra parameters.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
{IntRange? range}) → Future< ByteData?> -
Reads all the bytes or the given
range
. -
readArchiveEntryAt(
String path) → Future< ByteData?> -
Returns the Archive entry data at the given
path
in this file. -
stream(
) → Future< Stream< List< ?>int> > - Raw bytes stream of the content.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited