dart:core
UriData class
A way to access the structure of a data: URI.
Data URIs are non-hierarchical URIs that can contain any binary data. They are defined by RFC 2397.
This class allows parsing the URI text, extracting individual parts of the URI, as well as building the URI text from structured parts.
Constructors
- UriData.fromBytes(List<int> bytes, {String mimeType = "application/octet-stream", Map<String, String>? parameters, bool percentEncoded = false})
factory
- Creates a
data: URI containing an encoding of bytes. - UriData.fromString(String content, {String? mimeType, Encoding? encoding, Map<String, String>? parameters, bool base64 = false})
factory
- Creates a
data: URI containing the content string. - UriData.fromUri(Uri uri)
factory
- Creates a
DataUri from a Uri which must have data as Uri.scheme.
Properties
- charset → String
read-only
- The charset parameter of the media type.
- contentText → String
read-only
- The content part of the data URI, as its actual representation.
- hashCode → int
read-only, inherited
- The hash code for this object.
- isBase64 → bool
read-only
- Whether the data is Base64 encoded or not.
- mimeType → String
read-only
- The MIME type of the data URI.
- parameters → Map<String, String>
read-only
- A map representing the parameters of the media type.
- runtimeType → Type
read-only, inherited
- A representation of the runtime type of the object.
- uri → Uri
read-only
- The Uri that this
UriData is giving access to.
Methods
- contentAsBytes() → Uint8List
- The content part of the data URI as bytes.
- contentAsString({Encoding? encoding}) → String
- Creates a string from the content of the data URI.
- isCharset(String charset) → bool
@Since("2.17")
- Checks whether the charset parameter of the mime type is
charset. - isEncoding(Encoding encoding) → bool
@Since("2.17")
- Whether the charset parameter represents
encoding. - isMimeType(String mimeType) → bool
@Since("2.17")
- Whether the UriData.mimeType is equal to
mimeType. - noSuchMethod(Invocation invocation) → dynamic
inherited
- Invoked when a non-existent method or property is accessed.
- toString() → String
override
- A string representation of this object.
Operators
- operator ==(Object other) → bool
inherited
- The equality operator.
Static Methods
- parse(String uri) → UriData
- Parses a string as a
data URI.