diff --git a/packages/cross_file/CHANGELOG.md b/packages/cross_file/CHANGELOG.md index 52b11b97de35..2c4e4939615e 100644 --- a/packages/cross_file/CHANGELOG.md +++ b/packages/cross_file/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.4+1 + +* Removes a few deprecated API usages. + ## 0.3.4 * Updates to web code to package `web: ^0.5.0`. diff --git a/packages/cross_file/lib/src/types/html.dart b/packages/cross_file/lib/src/types/html.dart index a58dc35278b5..8bc5361bbfb2 100644 --- a/packages/cross_file/lib/src/types/html.dart +++ b/packages/cross_file/lib/src/types/html.dart @@ -8,7 +8,7 @@ import 'dart:js_interop'; import 'dart:typed_data'; import 'package:meta/meta.dart'; -import 'package:web/helpers.dart'; +import 'package:web/web.dart'; import '../web_helpers/web_helpers.dart'; import 'base.dart'; @@ -133,22 +133,26 @@ class XFile extends XFileBase { throw Exception('Safari cannot handle XFiles larger than 4GB.'); } - late XMLHttpRequest request; - try { - request = await HttpRequest.request(path, responseType: 'blob'); - } on ProgressEvent catch (e) { - if (e.type == 'error') { - throw Exception( - 'Could not load Blob from its URL. Has it been revoked?'); - } - rethrow; - } - - _browserBlob = request.response as Blob?; + final Completer blobCompleter = Completer(); - assert(_browserBlob != null, 'The Blob backing this XFile cannot be null!'); - - return _browserBlob!; + late XMLHttpRequest request; + request = XMLHttpRequest() + ..open('get', path, true) + ..responseType = 'blob' + ..onLoad.listen((ProgressEvent e) { + assert(request.response != null, + 'The Blob backing this XFile cannot be null!'); + blobCompleter.complete(request.response! as Blob); + }) + ..onError.listen((ProgressEvent e) { + if (e.type == 'error') { + blobCompleter.completeError(Exception( + 'Could not load Blob from its URL. Has it been revoked?')); + } + }) + ..send(); + + return blobCompleter.future; } @override diff --git a/packages/cross_file/lib/src/web_helpers/web_helpers.dart b/packages/cross_file/lib/src/web_helpers/web_helpers.dart index ec9a2e86e7d7..bd50fc989502 100644 --- a/packages/cross_file/lib/src/web_helpers/web_helpers.dart +++ b/packages/cross_file/lib/src/web_helpers/web_helpers.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:web/helpers.dart'; +import 'package:web/web.dart'; /// Create anchor element with download attribute HTMLAnchorElement createAnchorElement(String href, String? suggestedName) => @@ -20,11 +20,11 @@ void addElementToContainerAndClick(Element container, HTMLElement element) { /// Initializes a DOM container where elements can be injected. Element ensureInitialized(String id) { - Element? target = querySelector('#$id'); + Element? target = document.querySelector('#$id'); if (target == null) { final Element targetElement = document.createElement('flt-x-file')..id = id; - querySelector('body')!.appendChild(targetElement); + document.body!.appendChild(targetElement); target = targetElement; } return target; diff --git a/packages/cross_file/pubspec.yaml b/packages/cross_file/pubspec.yaml index b7b7f7af1088..cf8f9ca7d447 100644 --- a/packages/cross_file/pubspec.yaml +++ b/packages/cross_file/pubspec.yaml @@ -2,7 +2,7 @@ name: cross_file description: An abstraction to allow working with files across multiple platforms. repository: https://github.com/flutter/packages/tree/main/packages/cross_file issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+cross_file%22 -version: 0.3.4 +version: 0.3.4+1 environment: sdk: ^3.3.0 diff --git a/packages/cross_file/test/x_file_html_test.dart b/packages/cross_file/test/x_file_html_test.dart index 4b1dabd1583d..dedd8806f01a 100644 --- a/packages/cross_file/test/x_file_html_test.dart +++ b/packages/cross_file/test/x_file_html_test.dart @@ -11,7 +11,7 @@ import 'dart:typed_data'; import 'package:cross_file/cross_file.dart'; import 'package:test/test.dart'; -import 'package:web/helpers.dart' as html; +import 'package:web/web.dart' as html; const String expectedStringContents = 'Hello, world! I ❤ ñ! 空手'; final Uint8List bytes = Uint8List.fromList(utf8.encode(expectedStringContents)); @@ -95,7 +95,7 @@ void main() { await file.saveTo(''); final html.Element? container = - html.querySelector('#$crossFileDomElementId'); + html.document.querySelector('#$crossFileDomElementId'); expect(container, isNotNull); }); @@ -106,7 +106,7 @@ void main() { await file.saveTo('path'); final html.Element container = - html.querySelector('#$crossFileDomElementId')!; + html.document.querySelector('#$crossFileDomElementId')!; late html.HTMLAnchorElement element; for (int i = 0; i < container.childNodes.length; i++) { diff --git a/packages/file_selector/file_selector_web/CHANGELOG.md b/packages/file_selector/file_selector_web/CHANGELOG.md index e2dd2901aa8e..692d1da7589a 100644 --- a/packages/file_selector/file_selector_web/CHANGELOG.md +++ b/packages/file_selector/file_selector_web/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.4+1 + +* Removes a few deprecated API usages. + ## 0.9.4 * Updates web code to package `web: ^0.5.0`. diff --git a/packages/file_selector/file_selector_web/example/integration_test/dom_helper_test.dart b/packages/file_selector/file_selector_web/example/integration_test/dom_helper_test.dart index c4697a70a5d4..aa9dcdba187f 100644 --- a/packages/file_selector/file_selector_web/example/integration_test/dom_helper_test.dart +++ b/packages/file_selector/file_selector_web/example/integration_test/dom_helper_test.dart @@ -8,7 +8,7 @@ import 'package:file_selector_platform_interface/file_selector_platform_interfac import 'package:file_selector_web/src/dom_helper.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; -import 'package:web/helpers.dart'; +import 'package:web/web.dart'; void main() { group('dom_helper', () { @@ -41,7 +41,8 @@ void main() { setUp(() { domHelper = DomHelper(); - input = (createElementTag('input') as HTMLInputElement)..type = 'file'; + input = (document.createElement('input') as HTMLInputElement) + ..type = 'file'; }); group('getFiles', () { diff --git a/packages/file_selector/file_selector_web/example/integration_test/file_selector_web_test.dart b/packages/file_selector/file_selector_web/example/integration_test/file_selector_web_test.dart index f3d4c1ebf3e7..80376c5449fc 100644 --- a/packages/file_selector/file_selector_web/example/integration_test/file_selector_web_test.dart +++ b/packages/file_selector/file_selector_web/example/integration_test/file_selector_web_test.dart @@ -9,7 +9,7 @@ import 'package:file_selector_web/file_selector_web.dart'; import 'package:file_selector_web/src/dom_helper.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; -import 'package:web/helpers.dart'; +import 'package:web/web.dart'; void main() { group('FileSelectorWeb', () { diff --git a/packages/file_selector/file_selector_web/lib/src/dom_helper.dart b/packages/file_selector/file_selector_web/lib/src/dom_helper.dart index 309f0ee432f1..c19748b92443 100644 --- a/packages/file_selector/file_selector_web/lib/src/dom_helper.dart +++ b/packages/file_selector/file_selector_web/lib/src/dom_helper.dart @@ -8,7 +8,7 @@ import 'dart:js_interop'; import 'package:file_selector_platform_interface/file_selector_platform_interface.dart'; import 'package:flutter/foundation.dart' show visibleForTesting; import 'package:flutter/services.dart'; -import 'package:web/helpers.dart'; +import 'package:web/web.dart'; /// Class to manipulate the DOM with the intention of reading files from it. class DomHelper { diff --git a/packages/file_selector/file_selector_web/pubspec.yaml b/packages/file_selector/file_selector_web/pubspec.yaml index edc74e3064ea..2b4dc5cd7d9d 100644 --- a/packages/file_selector/file_selector_web/pubspec.yaml +++ b/packages/file_selector/file_selector_web/pubspec.yaml @@ -2,7 +2,7 @@ name: file_selector_web description: Web platform implementation of file_selector repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22 -version: 0.9.4 +version: 0.9.4+1 environment: sdk: ^3.3.0 diff --git a/packages/image_picker/image_picker_platform_interface/CHANGELOG.md b/packages/image_picker/image_picker_platform_interface/CHANGELOG.md index 854437f5d232..ef63d598bb83 100644 --- a/packages/image_picker/image_picker_platform_interface/CHANGELOG.md +++ b/packages/image_picker/image_picker_platform_interface/CHANGELOG.md @@ -1,6 +1,7 @@ -## NEXT +## 2.9.4 -* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. +* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. +* Removes a few deprecated API usages. ## 2.9.3 diff --git a/packages/image_picker/image_picker_platform_interface/lib/src/types/picked_file/html.dart b/packages/image_picker/image_picker_platform_interface/lib/src/types/picked_file/html.dart index 7d9761a57602..e296ceb9d80d 100644 --- a/packages/image_picker/image_picker_platform_interface/lib/src/types/picked_file/html.dart +++ b/packages/image_picker/image_picker_platform_interface/lib/src/types/picked_file/html.dart @@ -27,7 +27,7 @@ class PickedFile extends PickedFileBase { Future get _bytes async { if (_initBytes != null) { - return Future.value(UnmodifiableUint8ListView(_initBytes!)); + return _initBytes.asUnmodifiableView(); } return http.readBytes(Uri.parse(path)); } diff --git a/packages/image_picker/image_picker_platform_interface/pubspec.yaml b/packages/image_picker/image_picker_platform_interface/pubspec.yaml index 66b17ed51f47..b38945c6dac7 100644 --- a/packages/image_picker/image_picker_platform_interface/pubspec.yaml +++ b/packages/image_picker/image_picker_platform_interface/pubspec.yaml @@ -4,11 +4,11 @@ repository: https://github.com/flutter/packages/tree/main/packages/image_picker/ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.9.3 +version: 2.9.4 environment: - sdk: ^3.1.0 - flutter: ">=3.13.0" + sdk: ^3.3.0 + flutter: ">=3.19.0" dependencies: cross_file: ^0.3.1+1 diff --git a/packages/web_benchmarks/CHANGELOG.md b/packages/web_benchmarks/CHANGELOG.md index c4b3cf125ad2..02e11be9976d 100644 --- a/packages/web_benchmarks/CHANGELOG.md +++ b/packages/web_benchmarks/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.2.1 + +* Removes a few deprecated API usages. + ## 1.2.0 * Updates to web code to package `web: ^0.5.0`. diff --git a/packages/web_benchmarks/lib/client.dart b/packages/web_benchmarks/lib/client.dart index d1c52d775fb8..d800e97a7589 100644 --- a/packages/web_benchmarks/lib/client.dart +++ b/packages/web_benchmarks/lib/client.dart @@ -318,7 +318,7 @@ class LocalBenchmarkServerClient { /// DevTools Protocol. Future startPerformanceTracing(String? benchmarkName) async { _checkNotManualMode(); - await HttpRequest.request( + await _requestXhr( '/start-performance-tracing?label=$benchmarkName', method: 'POST', mimeType: 'application/json', @@ -328,7 +328,7 @@ class LocalBenchmarkServerClient { /// Stops the performance tracing session started by [startPerformanceTracing]. Future stopPerformanceTracing() async { _checkNotManualMode(); - await HttpRequest.request( + await _requestXhr( '/stop-performance-tracing', method: 'POST', mimeType: 'application/json', @@ -356,7 +356,7 @@ class LocalBenchmarkServerClient { /// The server will halt the devicelab task and log the error. Future reportError(dynamic error, StackTrace stackTrace) async { _checkNotManualMode(); - await HttpRequest.request( + await _requestXhr( '/on-error', method: 'POST', mimeType: 'application/json', @@ -370,7 +370,7 @@ class LocalBenchmarkServerClient { /// Reports a message about the demo to the benchmark server. Future printToConsole(String report) async { _checkNotManualMode(); - await HttpRequest.request( + await _requestXhr( '/print-to-console', method: 'POST', mimeType: 'text/plain', @@ -384,7 +384,7 @@ class LocalBenchmarkServerClient { String url, { required String method, required String mimeType, - required String sendData, + String? sendData, }) { final Completer completer = Completer(); final XMLHttpRequest xhr = XMLHttpRequest(); @@ -394,7 +394,11 @@ class LocalBenchmarkServerClient { completer.complete(xhr); }); xhr.onError.listen(completer.completeError); - xhr.send(sendData.toJS); + if (sendData != null) { + xhr.send(sendData.toJS); + } else { + xhr.send(); + } return completer.future; } } diff --git a/packages/web_benchmarks/lib/src/recorder.dart b/packages/web_benchmarks/lib/src/recorder.dart index 7488c44c2c41..85d841f1f8cd 100644 --- a/packages/web_benchmarks/lib/src/recorder.dart +++ b/packages/web_benchmarks/lib/src/recorder.dart @@ -248,6 +248,7 @@ abstract class SceneBuilderRecorder extends Recorder { } }; PlatformDispatcher.instance.onDrawFrame = () { + final FlutterView? view = PlatformDispatcher.instance.implicitView; try { _profile.record('drawFrameDuration', () { final SceneBuilder sceneBuilder = SceneBuilder(); @@ -255,7 +256,9 @@ abstract class SceneBuilderRecorder extends Recorder { _profile.record('sceneBuildDuration', () { final Scene scene = sceneBuilder.build(); _profile.record('windowRenderDuration', () { - window.render(scene); + assert(view != null, + 'Cannot profile windowRenderDuration on a null View.'); + view!.render(scene); }, reported: false); }, reported: false); }, reported: true); diff --git a/packages/web_benchmarks/pubspec.yaml b/packages/web_benchmarks/pubspec.yaml index 584e69706ee3..af66a69c9088 100644 --- a/packages/web_benchmarks/pubspec.yaml +++ b/packages/web_benchmarks/pubspec.yaml @@ -2,7 +2,7 @@ name: web_benchmarks description: A benchmark harness for performance-testing Flutter apps in Chrome. repository: https://github.com/flutter/packages/tree/main/packages/web_benchmarks issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+web_benchmarks%22 -version: 1.2.0 +version: 1.2.1 environment: sdk: ^3.3.0 @@ -14,7 +14,6 @@ dependencies: sdk: flutter flutter_test: sdk: flutter - http: ^1.0.0 logging: ^1.0.2 meta: ^1.7.0 path: ^1.8.0