Skip to content
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

Update platform-specific imports for wasm #1051

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/flutter_http_example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:provider/provider.dart';

import 'book.dart';
import 'http_client_factory.dart'
if (dart.library.html) 'http_client_factory_web.dart' as http_factory;
if (dart.library.js_interop) 'http_client_factory_web.dart' as http_factory;

void main() {
// `runWithClient` is used to control which `package:http` `Client` is used
Expand Down
4 changes: 2 additions & 2 deletions pkgs/http/lib/src/browser_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ BaseClient createClient() {
return BrowserClient();
}

/// A `dart:html`-based HTTP client that runs in the browser and is backed by
/// XMLHttpRequests.
/// A `package:web`-based HTTP client that runs in the browser and is backed by
/// [XMLHttpRequest].
///
/// This client inherits some of the limitations of XMLHttpRequest. It ignores
/// the [BaseRequest.contentLength], [BaseRequest.persistentConnection],
Expand Down
3 changes: 2 additions & 1 deletion pkgs/http/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ abstract interface class Client {
/// Creates a new platform appropriate client.
///
/// Creates an `IOClient` if `dart:io` is available and a `BrowserClient` if
/// `dart:html` is available, otherwise it will throw an unsupported error.
/// `dart:js_interop` is available, otherwise it will throw an unsupported
/// error.
factory Client() => zoneClient ?? createClient();

/// Sends an HTTP HEAD request with the given headers to the given URL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'request_body_server_vm.dart'
if (dart.library.html) 'request_body_server_web.dart';
if (dart.library.js_interop) 'request_body_server_web.dart';

/// Tests that the [Client] correctly implements [Client.close].
void testClose(Client Function() clientFactory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'compressed_response_body_server_vm.dart'
if (dart.library.html) 'compressed_response_body_server_web.dart';
if (dart.library.js_interop) 'compressed_response_body_server_web.dart';

/// Tests that the [Client] correctly implements HTTP responses with compressed
/// bodies.
Expand Down
4 changes: 2 additions & 2 deletions pkgs/http_client_conformance_tests/lib/src/isolate_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:isolate' if (dart.library.html) 'dummy_isolate.dart';
import 'dart:isolate' if (dart.library.js_interop) 'dummy_isolate.dart';

import 'package:async/async.dart';
import 'package:http/http.dart';
import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'request_body_server_vm.dart'
if (dart.library.html) 'request_body_server_web.dart';
if (dart.library.js_interop) 'request_body_server_web.dart';

Future<void> _testPost(Client Function() clientFactory, String host) async {
await Isolate.run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'multiple_clients_server_vm.dart'
if (dart.library.html) 'multiple_clients_server_web.dart';
if (dart.library.js_interop) 'multiple_clients_server_web.dart';

/// Tests that the [Client] works correctly if there are many used
/// simultaneously.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'redirect_server_vm.dart'
if (dart.library.html) 'redirect_server_web.dart';
if (dart.library.js_interop) 'redirect_server_web.dart';

/// Tests that the [Client] correctly implements HTTP redirect logic.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'request_body_streamed_server_vm.dart'
if (dart.library.html) 'request_body_streamed_server_web.dart';
if (dart.library.js_interop) 'request_body_streamed_server_web.dart';

/// Tests that the [Client] correctly implements streamed request body
/// uploading.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'request_body_server_vm.dart'
if (dart.library.html) 'request_body_server_web.dart';
if (dart.library.js_interop) 'request_body_server_web.dart';

class _Plus2Decoder extends Converter<List<int>, String> {
@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'request_headers_server_vm.dart'
if (dart.library.html) 'request_headers_server_web.dart';
if (dart.library.js_interop) 'request_headers_server_web.dart';

/// Tests that the [Client] correctly sends headers in the request.
void testRequestHeaders(Client client) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'response_body_streamed_server_vm.dart'
if (dart.library.html) 'response_body_streamed_server_web.dart';
if (dart.library.js_interop) 'response_body_streamed_server_web.dart';

/// Tests that the [Client] correctly implements HTTP responses with bodies of
/// unbounded size.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'response_body_server_vm.dart'
if (dart.library.html) 'response_body_server_web.dart';
if (dart.library.js_interop) 'response_body_server_web.dart';

/// Tests that the [Client] correctly implements HTTP responses with bodies.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'response_headers_server_vm.dart'
if (dart.library.html) 'response_headers_server_web.dart';
if (dart.library.js_interop) 'response_headers_server_web.dart';

/// Tests that the [Client] correctly processes response headers.
void testResponseHeaders(Client client) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'response_status_line_server_vm.dart'
if (dart.library.html) 'response_status_line_server_web.dart';
if (dart.library.js_interop) 'response_status_line_server_web.dart';

/// Tests that the [Client] correctly processes the response status line (e.g.
/// 'HTTP/1.1 200 OK\r\n').
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:stream_channel/stream_channel.dart';
import 'package:test/test.dart';

import 'server_errors_server_vm.dart'
if (dart.library.html) 'server_errors_server_web.dart';
if (dart.library.js_interop) 'server_errors_server_web.dart';

/// Tests that the [Client] correctly handles server errors.
void testServerErrors(Client client, {bool redirectAlwaysAllowed = false}) {
Expand Down
Loading