Relative File URIs and RFC 3986
(dart:io
, dart:core
)
#60639
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-core
type-enhancement
A request for a change that isn't a bug
Dart SDK version: 3.9.0-63.0.dev (dev) (Sun Apr 27 17:07:04 2025 -0700) on "macos_x64"
This is a discussion to determine if additional API would be beneficial and not a request to change current behaviour of current API since it is not a matter of correctness, so such changes would be non-necessarily breaking.
Current
dart:io
anddart:core
APIThe default behaviour which is documented for file system objects of
dart:io
and the URI API ofdart:core
is to treat relative paths as its own thing and not a URI with a scheme. For exampleoutputs
and
outputs nothing because there is no scheme.
Relative File URIs
RFC 3986
defines the URI grammar asApplying grammar productions using
path-rootless
, it is possible to derive File URIs of the formWhich is relative paths, optionally with queries and fragments eg
file:Documentation/readme.md#getting-started
.RFC 3986
ComplianceThe Dart behaviour deviates from
RFC 3986
, which is fine as its behaviour is documented and still practical. SinceRFC 3986
is a widely adopted specification, should additional API be introduced that conforms to it as expected. Something likewill have a URI
file:.
andwill also have URI
file:.
.This would also mean, for this new API,
?
can be treated as a query declaration and#
can be treated as the fragment declaration.The text was updated successfully, but these errors were encountered: