-
Notifications
You must be signed in to change notification settings - Fork 382
Make package:http/http.dart
support all platforms
#198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make package:http/http.dart
support all platforms
#198
Conversation
The |
Technically, yes. It has been supported by the language and vm/dart2js for some time. We only recently actually had support in build systems and things, but we can't express that dependency unfortunately (ideally, we would be able to say if you have a dependency on build_runner, it must be >x.x.x (which supports these imports), but we can't express that). |
I'm swamped with Sass work and it looks like Nate has this review in hand, so I'm going to remove myself. |
I think this might also close out #22 |
Fixes #22
Adds config specific imports to make
package:http/http.dart
support all platforms, and allow theClient
factory constructor to return a validClient
for the web platform.This should eliminate almost all need for the platform specific imports for consumers, although it does also add the
io_client.dart
public import.Passes presubmit internally, with edits in only 3 files (they use the IoClient constructor directly, and pass in an HttpClient). Externally build_runner now supports config specific imports as well, I am currently working on validating everything works as expected there with this change.
New Features
Client
factory constructor is now usable anywhere thatdart:io
or
dart:html
are available, and will give you anIoClient
orBrowserClient
respectively.package:http/http.dart
import is now safe to use on the web (oranywhere that either
dart:io
ordart:html
are available).Breaking Changes
IoClient
directly, you will need to importthe new
package:http/io_client.dart
import. This is typically only necessaryif you are passing a custom
HttpClient
instance to the constructor, in whichcase you are already giving up support for web.