Dart Uri data
Syntax & Examples
Uri.data property
The `data` property in Dart allows you to access the structure of a `data:` URI.
Syntax of Uri.data
The syntax of Uri.data property is:
UriData data
This data property of Uri access the structure of a data:
URI.
Return Type
Uri.data returns value of type UriData
.
✐ Example
1 Accessing the data structure of a URI
In this example,
- We create a UriData object using `Uri.dataFromString` with the string 'Hello, World!' and the MIME type 'text/plain'.
- We access the data structure of the URI using `uri.data`.
- We then print the data URI to standard output.
Dart Program
void main() {
Uri uri = Uri.dataFromString('Hello, World!', mimeType: 'text/plain');
print(uri.data);
}
Output
data:,Hello,%20World!
Summary
In this Dart tutorial, we learned about data property of Uri: the syntax and few working examples with output and detailed explanation for each example.