Suppose you want to send an empty search query to an API. For example:
In Dart, it makes sense to create this URI with:
final uri = Uri.https('api.example.com', 'search', {'query': ''});
But if you try to print this out: print(uri);
you will see:
My current workaround is to wrap double-quotes inside single-quotes (or other way around):
final uri = Uri.https('api.example.com', 'search', {'query': '""'});
which produces this URI:
Not a big deal. But still this behavior surprised me as a bit illogical. Who would want to send only a parameter name and not its value? Is it a problem of http library or am I missing something here? Is it the intended behavior and actually serves a purpose?