Closed natebosch closed 3 years ago
Why not Object?
– this is going to be annoying to deal with.
We didn't make the same update to SpanScanner.eager
in StringScanner
Why not
Object?
Because that doesn't add any safety from the calling side. It doesn't stop me from accidentally passing in a File
or something weird.
this is going to be annoying to deal with.
This is the direction we are moving with all arguments that unnecessarily are dynamic
or Object
to allow either String
or Uri
. Why do you think it will be annoying?
In all internal uses of this package, there was only a single library that I found was impacted. I did not scan on pub, but I don't expect there to be much impact.
The fix is also straightforward. https://dart-review.googlesource.com/c/sdk/+/171440
We didn't make the same update to
SpanScanner.eager
inStringScanner
We will. https://github.com/dart-lang/string_scanner/issues/30
ack...alright.
Adding a static type makes the API easier to use correctly. The call site can easily inline the
Uri.parse
if necessary.