Make it easy to use type B in place of type A when there is an obvious/explicit conversion from B -> A #107
Labels
request
Requests to resolve a particular developer problem
8000
Every place in
pkg:http
with aurl
parameter types it asdynamic
.This is to support a common use case: devs often want to pass either
Uri
or
String
to such methods. In the end, allString
values are "upgraded"to
Uri
before use. To support the desired flexibility, the user risksruntime errors if something other than
String
orUri
are provided.Flutter avoids this issue, by being explicit about types everywhere.
The existing request(s) for union types – https://github.com/dart-lang/sdk/issues/4938 and #83 – could be an option here, but it would require updating all parameters and setters to specify the supported types.
It'd be nice to be able to define explicit conversions so one could easily pass
String
to properties/params requiringUri
, etc.The text was updated successfully, but these errors were encountered: