Skip to content

Commit 5e84d9f

Browse files
authored
Update platform-specific imports for wasm (#1051)
Fix some docs
1 parent 8c9feb5 commit 5e84d9f

16 files changed

+19
-18
lines changed

pkgs/flutter_http_example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import 'package:provider/provider.dart';
1111

1212
import 'book.dart';
1313
import 'http_client_factory.dart'
14-
if (dart.library.html) 'http_client_factory_web.dart' as http_factory;
14+
if (dart.library.js_interop) 'http_client_factory_web.dart' as http_factory;
1515

1616
void main() {
1717
// `runWithClient` is used to control which `package:http` `Client` is used

pkgs/http/lib/src/browser_client.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ BaseClient createClient() {
2626
return BrowserClient();
2727
}
2828

29-
/// A `dart:html`-based HTTP client that runs in the browser and is backed by
30-
/// XMLHttpRequests.
29+
/// A `package:web`-based HTTP client that runs in the browser and is backed by
30+
/// [XMLHttpRequest].
3131
///
3232
/// This client inherits some of the limitations of XMLHttpRequest. It ignores
3333
/// the [BaseRequest.contentLength], [BaseRequest.persistentConnection],

pkgs/http/lib/src/client.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ abstract interface class Client {
3737
/// Creates a new platform appropriate client.
3838
///
3939
/// Creates an `IOClient` if `dart:io` is available and a `BrowserClient` if
40-
/// `dart:html` is available, otherwise it will throw an unsupported error.
40+
/// `dart:js_interop` is available, otherwise it will throw an unsupported
41+
/// error.
4142
factory Client() => zoneClient ?? createClient();
4243

4344
/// Sends an HTTP HEAD request with the given headers to the given URL.

pkgs/http_client_conformance_tests/lib/src/close_tests.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
88
import 'package:test/test.dart';
99

1010
import 'request_body_server_vm.dart'
11-
if (dart.library.html) 'request_body_server_web.dart';
11+
if (dart.library.js_interop) 'request_body_server_web.dart';
1212

1313
/// Tests that the [Client] correctly implements [Client.close].
1414
void testClose(Client Function() clientFactory) {

pkgs/http_client_conformance_tests/lib/src/compressed_response_body_tests.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
88
import 'package:test/test.dart';
99

1010
import 'compressed_response_body_server_vm.dart'
11-
if (dart.library.html) 'compressed_response_body_server_web.dart';
11+
if (dart.library.js_interop) 'compressed_response_body_server_web.dart';
1212

1313
/// Tests that the [Client] correctly implements HTTP responses with compressed
1414
/// bodies.

pkgs/http_client_conformance_tests/lib/src/isolate_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'dart:isolate' if (dart.library.html) 'dummy_isolate.dart';
5+
import 'dart:isolate' if (dart.library.js_interop) 'dummy_isolate.dart';
66

77
import 'package:async/async.dart';
88
import 'package:http/http.dart';
99
import 'package:stream_channel/stream_channel.dart';
1010
import 'package:test/test.dart';
1111

1212
import 'request_body_server_vm.dart'
13-
if (dart.library.html) 'request_body_server_web.dart';
13+
if (dart.library.js_interop) 'request_body_server_web.dart';
1414

1515
Future<void> _testPost(Client Function() clientFactory, String host) async {
1616
await Isolate.run(

pkgs/http_client_conformance_tests/lib/src/multiple_clients_tests.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
88
import 'package:test/test.dart';
99

1010
import 'multiple_clients_server_vm.dart'
11-
if (dart.library.html) 'multiple_clients_server_web.dart';
11+
if (dart.library.js_interop) 'multiple_clients_server_web.dart';
1212

1313
/// Tests that the [Client] works correctly if there are many used
1414
/// simultaneously.

pkgs/http_client_conformance_tests/lib/src/redirect_tests.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
88
import 'package:test/test.dart';
99

1010
import 'redirect_server_vm.dart'
11-
if (dart.library.html) 'redirect_server_web.dart';
11+
if (dart.library.js_interop) 'redirect_server_web.dart';
1212

1313
/// Tests that the [Client] correctly implements HTTP redirect logic.
1414
///

pkgs/http_client_conformance_tests/lib/src/request_body_streamed_tests.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import 'package:stream_channel/stream_channel.dart';
1111
import 'package:test/test.dart';
1212

1313
import 'request_body_streamed_server_vm.dart'
14-
if (dart.library.html) 'request_body_streamed_server_web.dart';
14+
if (dart.library.js_interop) 'request_body_streamed_server_web.dart';
1515

1616
/// Tests that the [Client] correctly implements streamed request body
1717
/// uploading.

pkgs/http_client_conformance_tests/lib/src/request_body_tests.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'package:stream_channel/stream_channel.dart';
1010
import 'package:test/test.dart';
1111

1212
import 'request_body_server_vm.dart'
13-
if (dart.library.html) 'request_body_server_web.dart';
13+
if (dart.library.js_interop) 'request_body_server_web.dart';
1414

1515
class _Plus2Decoder extends Converter<List<int>, String> {
1616
@override

0 commit comments

Comments
 (0)