UriData.fromUri factory constructor
UriData.fromUri(Creates a DataUri
from a Uri which must have data
as Uri.scheme.
The uri
must have scheme data
and no authority or fragment, and the path (concatenated with the query, if there is one) must be valid as data URI content with the same rules as parse.
Source
factory UriData.fromUri(Uri uri) { if (uri.scheme != "data") { throw new ArgumentError.value(uri, "uri", "Scheme must be 'data'"); } if (uri.hasAuthority) { throw new ArgumentError.value( uri, "uri", "Data uri must not have authority"); } if (uri.hasFragment) { throw new ArgumentError.value( uri, "uri", "Data uri must not have a fragment part"); } if (!uri.hasQuery) { return _parse(uri.path, 0, uri); } // Includes path and query (and leading "data:"). return _parse("$uri", 5, uri); }
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-core/UriData/UriData.fromUri.html