diff --git a/packages/file_selector/file_selector_web/CHANGELOG.md b/packages/file_selector/file_selector_web/CHANGELOG.md index f81c7921f0b..7391ceb875e 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.3 + +* Updates minimum supported SDK version to Dart 3.2. + ## 0.9.2+1 * Adds pub topics to package metadata. 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 d6cb47fe45b..09b15c2f0d7 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 @@ -2,23 +2,29 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:html'; +import 'dart:js_interop'; import 'package:file_selector_platform_interface/file_selector_platform_interface.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'; void main() { group('dom_helper', () { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); late DomHelper domHelper; - late FileUploadInputElement input; + late HTMLInputElement input; FileList? createFileList(List files) { final DataTransfer dataTransfer = DataTransfer(); - files.forEach(dataTransfer.items!.add); - return dataTransfer.files as FileList?; + for (final File e in files) { + // TODO(srujzs): This is necessary in order to support package:web 0.4.0. + // This was not needed with 0.3.0, hence the lint. + // ignore: unnecessary_cast + dataTransfer.items.add(e as JSAny); + } + return dataTransfer.files; } void setFilesAndTriggerEvent(List files, Event event) { @@ -36,12 +42,13 @@ void main() { setUp(() { domHelper = DomHelper(); - input = FileUploadInputElement(); + input = (createElementTag('input') as HTMLInputElement)..type = 'file'; }); group('getFiles', () { - final File mockFile1 = File(['123456'], 'file1.txt'); - final File mockFile2 = File([], 'file2.txt'); + final File mockFile1 = + File(['123456'].jsify as JSArray, 'file1.txt'); + final File mockFile2 = File([].jsify as JSArray, 'file2.txt'); testWidgets('works', (_) async { final Future> futureFiles = domHelper.getFiles( @@ -114,7 +121,7 @@ void main() { input: input, ); - expect(input.matchesWithAncestors('body'), true); + expect(input.matches('body'), true); expect(input.accept, accept); expect(input.multiple, multiple); expect( @@ -128,7 +135,7 @@ void main() { await futureFile; // It should be already removed from the DOM after the file is resolved. - expect(input.parent, isNull); + expect(input.parentElement, isNull); }); }); }); 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 f64c08de056..f3d4c1ebf3e 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 @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:html'; import 'dart:typed_data'; import 'package:file_selector_platform_interface/file_selector_platform_interface.dart'; @@ -10,6 +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'; void main() { group('FileSelectorWeb', () { @@ -121,7 +121,7 @@ class MockDomHelper implements DomHelper { Future> getFiles({ String accept = '', bool multiple = false, - FileUploadInputElement? input, + HTMLInputElement? input, }) { expect(accept, _expectedAccept, reason: 'Expected "accept" value does not match.'); diff --git a/packages/file_selector/file_selector_web/example/pubspec.yaml b/packages/file_selector/file_selector_web/example/pubspec.yaml index 0efe95c570c..b5166a65d70 100644 --- a/packages/file_selector/file_selector_web/example/pubspec.yaml +++ b/packages/file_selector/file_selector_web/example/pubspec.yaml @@ -11,6 +11,7 @@ dependencies: path: ../ flutter: sdk: flutter + web: '>=0.3.0 <0.5.0' dev_dependencies: flutter_test: 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 e600778b7dc..7684a12286d 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 @@ -3,41 +3,46 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:html'; +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'; /// Class to manipulate the DOM with the intention of reading files from it. class DomHelper { /// Default constructor, initializes the container DOM element. DomHelper() { final Element body = querySelector('body')!; - body.children.add(_container); + body.appendChild(_container); } - final Element _container = Element.tag('file-selector'); + final Element _container = createElementTag('file-selector'); /// Sets the attributes and waits for a file to be selected. Future> getFiles({ String accept = '', bool multiple = false, - @visibleForTesting FileUploadInputElement? input, + @visibleForTesting HTMLInputElement? input, }) { final Completer> completer = Completer>(); - final FileUploadInputElement inputElement = - input ?? FileUploadInputElement(); + final HTMLInputElement inputElement = + input ?? (createElementTag('input') as HTMLInputElement) + ..type = 'file'; - _container.children.add( + _container.appendChild( inputElement ..accept = accept ..multiple = multiple, ); inputElement.onChange.first.then((_) { - final List files = - inputElement.files!.map(_convertFileToXFile).toList(); + final List files = Iterable.generate( + inputElement.files!.length, + (int i) => inputElement.files!.item(i)!) + .map(_convertFileToXFile) + .toList(); inputElement.remove(); completer.complete(files); }); @@ -52,10 +57,13 @@ class DomHelper { completer.completeError(platformException); }); - inputElement.addEventListener('cancel', (Event event) { - inputElement.remove(); - completer.complete([]); - }); + inputElement.addEventListener( + 'cancel', + (Event event) { + inputElement.remove(); + completer.complete([]); + }.toJS, + ); // TODO(dit): Reimplement this with the showPicker() API, https://github.com/flutter/flutter/issues/130365 inputElement.click(); @@ -64,10 +72,12 @@ class DomHelper { } XFile _convertFileToXFile(File file) => XFile( - Url.createObjectUrl(file), + // TODO(srujzs): This is necessary in order to support package:web 0.4.0. + // This was not needed with 0.3.0, hence the lint. + // ignore: unnecessary_cast + URL.createObjectURL(file as JSObject), name: file.name, length: file.size, - lastModified: DateTime.fromMillisecondsSinceEpoch( - file.lastModified ?? DateTime.now().millisecondsSinceEpoch), + lastModified: DateTime.fromMillisecondsSinceEpoch(file.lastModified), ); } diff --git a/packages/file_selector/file_selector_web/pubspec.yaml b/packages/file_selector/file_selector_web/pubspec.yaml index 8198aae05e8..3c3ca15c3aa 100644 --- a/packages/file_selector/file_selector_web/pubspec.yaml +++ b/packages/file_selector/file_selector_web/pubspec.yaml @@ -2,11 +2,11 @@ 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.2+1 +version: 0.9.3 environment: - sdk: ">=2.19.0 <4.0.0" - flutter: ">=3.7.0" + sdk: ^3.2.0 + flutter: ">=3.16.0" flutter: plugin: @@ -22,6 +22,7 @@ dependencies: sdk: flutter flutter_web_plugins: sdk: flutter + web: '>=0.3.0 <0.5.0' dev_dependencies: flutter_test: diff --git a/packages/url_launcher/url_launcher_web/CHANGELOG.md b/packages/url_launcher/url_launcher_web/CHANGELOG.md index 76979c9c4c6..6088079c009 100644 --- a/packages/url_launcher/url_launcher_web/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_web/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.2.1 + +* Updates minimum supported SDK version to Dart 3.2. + ## 2.2.0 * Implements `supportsMode` and `supportsCloseForMode`. diff --git a/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.dart b/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.dart index 994e3b28bad..7d9510e4146 100644 --- a/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.dart +++ b/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.dart @@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:html' as html; - import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; import 'package:url_launcher_web/url_launcher_web.dart'; +import 'package:web/web.dart' as html; import 'url_launcher_web_test.mocks.dart'; @@ -29,7 +28,7 @@ void main() { when(mockWindow.navigator).thenReturn(mockNavigator); // Simulate that window.open does something. - when(mockWindow.open(any, any, any)).thenReturn(MockWindow()); + when(mockWindow.open('any', 'any')).thenReturn(MockWindow()); when(mockNavigator.userAgent).thenReturn( 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'); diff --git a/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.mocks.dart b/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.mocks.dart index 13ff194eabc..5f4467a338a 100644 --- a/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.mocks.dart +++ b/packages/url_launcher/url_launcher_web/example/integration_test/url_launcher_web_test.mocks.dart @@ -5,11 +5,8 @@ // @dart=2.19 // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i3; -import 'dart:html' as _i2; -import 'dart:math' as _i4; - import 'package:mockito/mockito.dart' as _i1; +import 'package:web/src/dom/html.dart' as _i2; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -22,169 +19,6 @@ import 'package:mockito/mockito.dart' as _i1; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeDocument_0 extends _i1.SmartFake implements _i2.Document { - _FakeDocument_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeLocation_1 extends _i1.SmartFake implements _i2.Location { - _FakeLocation_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeConsole_2 extends _i1.SmartFake implements _i2.Console { - _FakeConsole_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeHistory_3 extends _i1.SmartFake implements _i2.History { - _FakeHistory_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeStorage_4 extends _i1.SmartFake implements _i2.Storage { - _FakeStorage_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeNavigator_5 extends _i1.SmartFake implements _i2.Navigator { - _FakeNavigator_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakePerformance_6 extends _i1.SmartFake implements _i2.Performance { - _FakePerformance_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeEvents_7 extends _i1.SmartFake implements _i2.Events { - _FakeEvents_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeWindowBase_8 extends _i1.SmartFake implements _i2.WindowBase { - _FakeWindowBase_8( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeFileSystem_9 extends _i1.SmartFake implements _i2.FileSystem { - _FakeFileSystem_9( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeStylePropertyMapReadonly_10 extends _i1.SmartFake - implements _i2.StylePropertyMapReadonly { - _FakeStylePropertyMapReadonly_10( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeMediaQueryList_11 extends _i1.SmartFake - implements _i2.MediaQueryList { - _FakeMediaQueryList_11( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeEntry_12 extends _i1.SmartFake implements _i2.Entry { - _FakeEntry_12( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeGeolocation_13 extends _i1.SmartFake implements _i2.Geolocation { - _FakeGeolocation_13( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeMediaStream_14 extends _i1.SmartFake implements _i2.MediaStream { - _FakeMediaStream_14( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeRelatedApplication_15 extends _i1.SmartFake - implements _i2.RelatedApplication { - _FakeRelatedApplication_15( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - /// A class which mocks [Window]. /// /// See the documentation for Mockito's code generation for more information. @@ -192,1097 +26,6 @@ class MockWindow extends _i1.Mock implements _i2.Window { MockWindow() { _i1.throwOnMissingStub(this); } - - @override - _i3.Future get animationFrame => (super.noSuchMethod( - Invocation.getter(#animationFrame), - returnValue: _i3.Future.value(0), - ) as _i3.Future); - - @override - _i2.Document get document => (super.noSuchMethod( - Invocation.getter(#document), - returnValue: _FakeDocument_0( - this, - Invocation.getter(#document), - ), - ) as _i2.Document); - - @override - _i2.Location get location => (super.noSuchMethod( - Invocation.getter(#location), - returnValue: _FakeLocation_1( - this, - Invocation.getter(#location), - ), - ) as _i2.Location); - - @override - set location(_i2.LocationBase? value) => super.noSuchMethod( - Invocation.setter( - #location, - value, - ), - returnValueForMissingStub: null, - ); - - @override - _i2.Console get console => (super.noSuchMethod( - Invocation.getter(#console), - returnValue: _FakeConsole_2( - this, - Invocation.getter(#console), - ), - ) as _i2.Console); - - @override - set defaultStatus(String? value) => super.noSuchMethod( - Invocation.setter( - #defaultStatus, - value, - ), - returnValueForMissingStub: null, - ); - - @override - set defaultstatus(String? value) => super.noSuchMethod( - Invocation.setter( - #defaultstatus, - value, - ), - returnValueForMissingStub: null, - ); - - @override - num get devicePixelRatio => (super.noSuchMethod( - Invocation.getter(#devicePixelRatio), - returnValue: 0, - ) as num); - - @override - _i2.History get history => (super.noSuchMethod( - Invocation.getter(#history), - returnValue: _FakeHistory_3( - this, - Invocation.getter(#history), - ), - ) as _i2.History); - - @override - _i2.Storage get localStorage => (super.noSuchMethod( - Invocation.getter(#localStorage), - returnValue: _FakeStorage_4( - this, - Invocation.getter(#localStorage), - ), - ) as _i2.Storage); - - @override - set name(String? value) => super.noSuchMethod( - Invocation.setter( - #name, - value, - ), - returnValueForMissingStub: null, - ); - - @override - _i2.Navigator get navigator => (super.noSuchMethod( - Invocation.getter(#navigator), - returnValue: _FakeNavigator_5( - this, - Invocation.getter(#navigator), - ), - ) as _i2.Navigator); - - @override - set opener(_i2.WindowBase? value) => super.noSuchMethod( - Invocation.setter( - #opener, - value, - ), - returnValueForMissingStub: null, - ); - - @override - int get outerHeight => (super.noSuchMethod( - Invocation.getter(#outerHeight), - returnValue: 0, - ) as int); - - @override - int get outerWidth => (super.noSuchMethod( - Invocation.getter(#outerWidth), - returnValue: 0, - ) as int); - - @override - _i2.Performance get performance => (super.noSuchMethod( - Invocation.getter(#performance), - returnValue: _FakePerformance_6( - this, - Invocation.getter(#performance), - ), - ) as _i2.Performance); - - @override - _i2.Storage get sessionStorage => (super.noSuchMethod( - Invocation.getter(#sessionStorage), - returnValue: _FakeStorage_4( - this, - Invocation.getter(#sessionStorage), - ), - ) as _i2.Storage); - - @override - set status(String? value) => super.noSuchMethod( - Invocation.setter( - #status, - value, - ), - returnValueForMissingStub: null, - ); - - @override - _i3.Stream<_i2.Event> get onContentLoaded => (super.noSuchMethod( - Invocation.getter(#onContentLoaded), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onAbort => (super.noSuchMethod( - Invocation.getter(#onAbort), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onBlur => (super.noSuchMethod( - Invocation.getter(#onBlur), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onCanPlay => (super.noSuchMethod( - Invocation.getter(#onCanPlay), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onCanPlayThrough => (super.noSuchMethod( - Invocation.getter(#onCanPlayThrough), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onChange => (super.noSuchMethod( - Invocation.getter(#onChange), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.MouseEvent> get onClick => (super.noSuchMethod( - Invocation.getter(#onClick), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onContextMenu => (super.noSuchMethod( - Invocation.getter(#onContextMenu), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.Event> get onDoubleClick => (super.noSuchMethod( - Invocation.getter(#onDoubleClick), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.DeviceMotionEvent> get onDeviceMotion => (super.noSuchMethod( - Invocation.getter(#onDeviceMotion), - returnValue: _i3.Stream<_i2.DeviceMotionEvent>.empty(), - ) as _i3.Stream<_i2.DeviceMotionEvent>); - - @override - _i3.Stream<_i2.DeviceOrientationEvent> get onDeviceOrientation => - (super.noSuchMethod( - Invocation.getter(#onDeviceOrientation), - returnValue: _i3.Stream<_i2.DeviceOrientationEvent>.empty(), - ) as _i3.Stream<_i2.DeviceOrientationEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onDrag => (super.noSuchMethod( - Invocation.getter(#onDrag), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onDragEnd => (super.noSuchMethod( - Invocation.getter(#onDragEnd), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onDragEnter => (super.noSuchMethod( - Invocation.getter(#onDragEnter), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onDragLeave => (super.noSuchMethod( - Invocation.getter(#onDragLeave), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onDragOver => (super.noSuchMethod( - Invocation.getter(#onDragOver), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onDragStart => (super.noSuchMethod( - Invocation.getter(#onDragStart), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onDrop => (super.noSuchMethod( - Invocation.getter(#onDrop), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.Event> get onDurationChange => (super.noSuchMethod( - Invocation.getter(#onDurationChange), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onEmptied => (super.noSuchMethod( - Invocation.getter(#onEmptied), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onEnded => (super.noSuchMethod( - Invocation.getter(#onEnded), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onError => (super.noSuchMethod( - Invocation.getter(#onError), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onFocus => (super.noSuchMethod( - Invocation.getter(#onFocus), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onHashChange => (super.noSuchMethod( - Invocation.getter(#onHashChange), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onInput => (super.noSuchMethod( - Invocation.getter(#onInput), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onInvalid => (super.noSuchMethod( - Invocation.getter(#onInvalid), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.KeyboardEvent> get onKeyDown => (super.noSuchMethod( - Invocation.getter(#onKeyDown), - returnValue: _i3.Stream<_i2.KeyboardEvent>.empty(), - ) as _i3.Stream<_i2.KeyboardEvent>); - - @override - _i3.Stream<_i2.KeyboardEvent> get onKeyPress => (super.noSuchMethod( - Invocation.getter(#onKeyPress), - returnValue: _i3.Stream<_i2.KeyboardEvent>.empty(), - ) as _i3.Stream<_i2.KeyboardEvent>); - - @override - _i3.Stream<_i2.KeyboardEvent> get onKeyUp => (super.noSuchMethod( - Invocation.getter(#onKeyUp), - returnValue: _i3.Stream<_i2.KeyboardEvent>.empty(), - ) as _i3.Stream<_i2.KeyboardEvent>); - - @override - _i3.Stream<_i2.Event> get onLoad => (super.noSuchMethod( - Invocation.getter(#onLoad), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onLoadedData => (super.noSuchMethod( - Invocation.getter(#onLoadedData), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onLoadedMetadata => (super.noSuchMethod( - Invocation.getter(#onLoadedMetadata), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onLoadStart => (super.noSuchMethod( - Invocation.getter(#onLoadStart), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.MessageEvent> get onMessage => (super.noSuchMethod( - Invocation.getter(#onMessage), - returnValue: _i3.Stream<_i2.MessageEvent>.empty(), - ) as _i3.Stream<_i2.MessageEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onMouseDown => (super.noSuchMethod( - Invocation.getter(#onMouseDown), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onMouseEnter => (super.noSuchMethod( - Invocation.getter(#onMouseEnter), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onMouseLeave => (super.noSuchMethod( - Invocation.getter(#onMouseLeave), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onMouseMove => (super.noSuchMethod( - Invocation.getter(#onMouseMove), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onMouseOut => (super.noSuchMethod( - Invocation.getter(#onMouseOut), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onMouseOver => (super.noSuchMethod( - Invocation.getter(#onMouseOver), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.MouseEvent> get onMouseUp => (super.noSuchMethod( - Invocation.getter(#onMouseUp), - returnValue: _i3.Stream<_i2.MouseEvent>.empty(), - ) as _i3.Stream<_i2.MouseEvent>); - - @override - _i3.Stream<_i2.WheelEvent> get onMouseWheel => (super.noSuchMethod( - Invocation.getter(#onMouseWheel), - returnValue: _i3.Stream<_i2.WheelEvent>.empty(), - ) as _i3.Stream<_i2.WheelEvent>); - - @override - _i3.Stream<_i2.Event> get onOffline => (super.noSuchMethod( - Invocation.getter(#onOffline), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onOnline => (super.noSuchMethod( - Invocation.getter(#onOnline), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onPageHide => (super.noSuchMethod( - Invocation.getter(#onPageHide), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onPageShow => (super.noSuchMethod( - Invocation.getter(#onPageShow), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onPause => (super.noSuchMethod( - Invocation.getter(#onPause), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onPlay => (super.noSuchMethod( - Invocation.getter(#onPlay), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onPlaying => (super.noSuchMethod( - Invocation.getter(#onPlaying), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.PopStateEvent> get onPopState => (super.noSuchMethod( - Invocation.getter(#onPopState), - returnValue: _i3.Stream<_i2.PopStateEvent>.empty(), - ) as _i3.Stream<_i2.PopStateEvent>); - - @override - _i3.Stream<_i2.Event> get onProgress => (super.noSuchMethod( - Invocation.getter(#onProgress), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onRateChange => (super.noSuchMethod( - Invocation.getter(#onRateChange), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onReset => (super.noSuchMethod( - Invocation.getter(#onReset), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onResize => (super.noSuchMethod( - Invocation.getter(#onResize), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onScroll => (super.noSuchMethod( - Invocation.getter(#onScroll), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onSearch => (super.noSuchMethod( - Invocation.getter(#onSearch), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onSeeked => (super.noSuchMethod( - Invocation.getter(#onSeeked), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onSeeking => (super.noSuchMethod( - Invocation.getter(#onSeeking), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onSelect => (super.noSuchMethod( - Invocation.getter(#onSelect), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onStalled => (super.noSuchMethod( - Invocation.getter(#onStalled), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.StorageEvent> get onStorage => (super.noSuchMethod( - Invocation.getter(#onStorage), - returnValue: _i3.Stream<_i2.StorageEvent>.empty(), - ) as _i3.Stream<_i2.StorageEvent>); - - @override - _i3.Stream<_i2.Event> get onSubmit => (super.noSuchMethod( - Invocation.getter(#onSubmit), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onSuspend => (super.noSuchMethod( - Invocation.getter(#onSuspend), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onTimeUpdate => (super.noSuchMethod( - Invocation.getter(#onTimeUpdate), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.TouchEvent> get onTouchCancel => (super.noSuchMethod( - Invocation.getter(#onTouchCancel), - returnValue: _i3.Stream<_i2.TouchEvent>.empty(), - ) as _i3.Stream<_i2.TouchEvent>); - - @override - _i3.Stream<_i2.TouchEvent> get onTouchEnd => (super.noSuchMethod( - Invocation.getter(#onTouchEnd), - returnValue: _i3.Stream<_i2.TouchEvent>.empty(), - ) as _i3.Stream<_i2.TouchEvent>); - - @override - _i3.Stream<_i2.TouchEvent> get onTouchMove => (super.noSuchMethod( - Invocation.getter(#onTouchMove), - returnValue: _i3.Stream<_i2.TouchEvent>.empty(), - ) as _i3.Stream<_i2.TouchEvent>); - - @override - _i3.Stream<_i2.TouchEvent> get onTouchStart => (super.noSuchMethod( - Invocation.getter(#onTouchStart), - returnValue: _i3.Stream<_i2.TouchEvent>.empty(), - ) as _i3.Stream<_i2.TouchEvent>); - - @override - _i3.Stream<_i2.TransitionEvent> get onTransitionEnd => (super.noSuchMethod( - Invocation.getter(#onTransitionEnd), - returnValue: _i3.Stream<_i2.TransitionEvent>.empty(), - ) as _i3.Stream<_i2.TransitionEvent>); - - @override - _i3.Stream<_i2.Event> get onUnload => (super.noSuchMethod( - Invocation.getter(#onUnload), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onVolumeChange => (super.noSuchMethod( - Invocation.getter(#onVolumeChange), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.Event> get onWaiting => (super.noSuchMethod( - Invocation.getter(#onWaiting), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.AnimationEvent> get onAnimationEnd => (super.noSuchMethod( - Invocation.getter(#onAnimationEnd), - returnValue: _i3.Stream<_i2.AnimationEvent>.empty(), - ) as _i3.Stream<_i2.AnimationEvent>); - - @override - _i3.Stream<_i2.AnimationEvent> get onAnimationIteration => - (super.noSuchMethod( - Invocation.getter(#onAnimationIteration), - returnValue: _i3.Stream<_i2.AnimationEvent>.empty(), - ) as _i3.Stream<_i2.AnimationEvent>); - - @override - _i3.Stream<_i2.AnimationEvent> get onAnimationStart => (super.noSuchMethod( - Invocation.getter(#onAnimationStart), - returnValue: _i3.Stream<_i2.AnimationEvent>.empty(), - ) as _i3.Stream<_i2.AnimationEvent>); - - @override - _i3.Stream<_i2.Event> get onBeforeUnload => (super.noSuchMethod( - Invocation.getter(#onBeforeUnload), - returnValue: _i3.Stream<_i2.Event>.empty(), - ) as _i3.Stream<_i2.Event>); - - @override - _i3.Stream<_i2.WheelEvent> get onWheel => (super.noSuchMethod( - Invocation.getter(#onWheel), - returnValue: _i3.Stream<_i2.WheelEvent>.empty(), - ) as _i3.Stream<_i2.WheelEvent>); - - @override - int get pageXOffset => (super.noSuchMethod( - Invocation.getter(#pageXOffset), - returnValue: 0, - ) as int); - - @override - int get pageYOffset => (super.noSuchMethod( - Invocation.getter(#pageYOffset), - returnValue: 0, - ) as int); - - @override - int get scrollX => (super.noSuchMethod( - Invocation.getter(#scrollX), - returnValue: 0, - ) as int); - - @override - int get scrollY => (super.noSuchMethod( - Invocation.getter(#scrollY), - returnValue: 0, - ) as int); - - @override - _i2.Events get on => (super.noSuchMethod( - Invocation.getter(#on), - returnValue: _FakeEvents_7( - this, - Invocation.getter(#on), - ), - ) as _i2.Events); - - @override - _i2.WindowBase open( - String? url, - String? name, [ - String? options, - ]) => - (super.noSuchMethod( - Invocation.method( - #open, - [ - url, - name, - options, - ], - ), - returnValue: _FakeWindowBase_8( - this, - Invocation.method( - #open, - [ - url, - name, - options, - ], - ), - ), - ) as _i2.WindowBase); - - @override - int requestAnimationFrame(_i2.FrameRequestCallback? callback) => - (super.noSuchMethod( - Invocation.method( - #requestAnimationFrame, - [callback], - ), - returnValue: 0, - ) as int); - - @override - void cancelAnimationFrame(int? id) => super.noSuchMethod( - Invocation.method( - #cancelAnimationFrame, - [id], - ), - returnValueForMissingStub: null, - ); - - @override - _i3.Future<_i2.FileSystem> requestFileSystem( - int? size, { - bool? persistent = false, - }) => - (super.noSuchMethod( - Invocation.method( - #requestFileSystem, - [size], - {#persistent: persistent}, - ), - returnValue: _i3.Future<_i2.FileSystem>.value(_FakeFileSystem_9( - this, - Invocation.method( - #requestFileSystem, - [size], - {#persistent: persistent}, - ), - )), - ) as _i3.Future<_i2.FileSystem>); - - @override - void alert([String? message]) => super.noSuchMethod( - Invocation.method( - #alert, - [message], - ), - returnValueForMissingStub: null, - ); - - @override - void cancelIdleCallback(int? handle) => super.noSuchMethod( - Invocation.method( - #cancelIdleCallback, - [handle], - ), - returnValueForMissingStub: null, - ); - - @override - void close() => super.noSuchMethod( - Invocation.method( - #close, - [], - ), - returnValueForMissingStub: null, - ); - - @override - bool confirm([String? message]) => (super.noSuchMethod( - Invocation.method( - #confirm, - [message], - ), - returnValue: false, - ) as bool); - - @override - _i3.Future fetch( - dynamic input, [ - Map? init, - ]) => - (super.noSuchMethod( - Invocation.method( - #fetch, - [ - input, - init, - ], - ), - returnValue: _i3.Future.value(), - ) as _i3.Future); - - @override - bool find( - String? string, - bool? caseSensitive, - bool? backwards, - bool? wrap, - bool? wholeWord, - bool? searchInFrames, - bool? showDialog, - ) => - (super.noSuchMethod( - Invocation.method( - #find, - [ - string, - caseSensitive, - backwards, - wrap, - wholeWord, - searchInFrames, - showDialog, - ], - ), - returnValue: false, - ) as bool); - - @override - _i2.StylePropertyMapReadonly getComputedStyleMap( - _i2.Element? element, - String? pseudoElement, - ) => - (super.noSuchMethod( - Invocation.method( - #getComputedStyleMap, - [ - element, - pseudoElement, - ], - ), - returnValue: _FakeStylePropertyMapReadonly_10( - this, - Invocation.method( - #getComputedStyleMap, - [ - element, - pseudoElement, - ], - ), - ), - ) as _i2.StylePropertyMapReadonly); - - @override - List<_i2.CssRule> getMatchedCssRules( - _i2.Element? element, - String? pseudoElement, - ) => - (super.noSuchMethod( - Invocation.method( - #getMatchedCssRules, - [ - element, - pseudoElement, - ], - ), - returnValue: <_i2.CssRule>[], - ) as List<_i2.CssRule>); - - @override - _i2.MediaQueryList matchMedia(String? query) => (super.noSuchMethod( - Invocation.method( - #matchMedia, - [query], - ), - returnValue: _FakeMediaQueryList_11( - this, - Invocation.method( - #matchMedia, - [query], - ), - ), - ) as _i2.MediaQueryList); - - @override - void moveBy( - int? x, - int? y, - ) => - super.noSuchMethod( - Invocation.method( - #moveBy, - [ - x, - y, - ], - ), - returnValueForMissingStub: null, - ); - - @override - void postMessage( - dynamic message, - String? targetOrigin, [ - List? transfer, - ]) => - super.noSuchMethod( - Invocation.method( - #postMessage, - [ - message, - targetOrigin, - transfer, - ], - ), - returnValueForMissingStub: null, - ); - - @override - void print() => super.noSuchMethod( - Invocation.method( - #print, - [], - ), - returnValueForMissingStub: null, - ); - - @override - int requestIdleCallback( - _i2.IdleRequestCallback? callback, [ - Map? options, - ]) => - (super.noSuchMethod( - Invocation.method( - #requestIdleCallback, - [ - callback, - options, - ], - ), - returnValue: 0, - ) as int); - - @override - void resizeBy( - int? x, - int? y, - ) => - super.noSuchMethod( - Invocation.method( - #resizeBy, - [ - x, - y, - ], - ), - returnValueForMissingStub: null, - ); - - @override - void resizeTo( - int? x, - int? y, - ) => - super.noSuchMethod( - Invocation.method( - #resizeTo, - [ - x, - y, - ], - ), - returnValueForMissingStub: null, - ); - - @override - void scroll([ - dynamic options_OR_x, - dynamic y, - Map? scrollOptions, - ]) => - super.noSuchMethod( - Invocation.method( - #scroll, - [ - options_OR_x, - y, - scrollOptions, - ], - ), - returnValueForMissingStub: null, - ); - - @override - void scrollBy([ - dynamic options_OR_x, - dynamic y, - Map? scrollOptions, - ]) => - super.noSuchMethod( - Invocation.method( - #scrollBy, - [ - options_OR_x, - y, - scrollOptions, - ], - ), - returnValueForMissingStub: null, - ); - - @override - void scrollTo([ - dynamic options_OR_x, - dynamic y, - Map? scrollOptions, - ]) => - super.noSuchMethod( - Invocation.method( - #scrollTo, - [ - options_OR_x, - y, - scrollOptions, - ], - ), - returnValueForMissingStub: null, - ); - - @override - void stop() => super.noSuchMethod( - Invocation.method( - #stop, - [], - ), - returnValueForMissingStub: null, - ); - - @override - _i3.Future<_i2.Entry> resolveLocalFileSystemUrl(String? url) => - (super.noSuchMethod( - Invocation.method( - #resolveLocalFileSystemUrl, - [url], - ), - returnValue: _i3.Future<_i2.Entry>.value(_FakeEntry_12( - this, - Invocation.method( - #resolveLocalFileSystemUrl, - [url], - ), - )), - ) as _i3.Future<_i2.Entry>); - - @override - String atob(String? atob) => (super.noSuchMethod( - Invocation.method( - #atob, - [atob], - ), - returnValue: '', - ) as String); - - @override - String btoa(String? btoa) => (super.noSuchMethod( - Invocation.method( - #btoa, - [btoa], - ), - returnValue: '', - ) as String); - - @override - void moveTo(_i4.Point? p) => super.noSuchMethod( - Invocation.method( - #moveTo, - [p], - ), - returnValueForMissingStub: null, - ); - - @override - void addEventListener( - String? type, - _i2.EventListener? listener, [ - bool? useCapture, - ]) => - super.noSuchMethod( - Invocation.method( - #addEventListener, - [ - type, - listener, - useCapture, - ], - ), - returnValueForMissingStub: null, - ); - - @override - void removeEventListener( - String? type, - _i2.EventListener? listener, [ - bool? useCapture, - ]) => - super.noSuchMethod( - Invocation.method( - #removeEventListener, - [ - type, - listener, - useCapture, - ], - ), - returnValueForMissingStub: null, - ); - - @override - bool dispatchEvent(_i2.Event? event) => (super.noSuchMethod( - Invocation.method( - #dispatchEvent, - [event], - ), - returnValue: false, - ) as bool); } /// A class which mocks [Navigator]. @@ -1292,221 +35,4 @@ class MockNavigator extends _i1.Mock implements _i2.Navigator { MockNavigator() { _i1.throwOnMissingStub(this); } - - @override - String get language => (super.noSuchMethod( - Invocation.getter(#language), - returnValue: '', - ) as String); - - @override - _i2.Geolocation get geolocation => (super.noSuchMethod( - Invocation.getter(#geolocation), - returnValue: _FakeGeolocation_13( - this, - Invocation.getter(#geolocation), - ), - ) as _i2.Geolocation); - - @override - String get vendor => (super.noSuchMethod( - Invocation.getter(#vendor), - returnValue: '', - ) as String); - - @override - String get vendorSub => (super.noSuchMethod( - Invocation.getter(#vendorSub), - returnValue: '', - ) as String); - - @override - String get appCodeName => (super.noSuchMethod( - Invocation.getter(#appCodeName), - returnValue: '', - ) as String); - - @override - String get appName => (super.noSuchMethod( - Invocation.getter(#appName), - returnValue: '', - ) as String); - - @override - String get appVersion => (super.noSuchMethod( - Invocation.getter(#appVersion), - returnValue: '', - ) as String); - - @override - String get product => (super.noSuchMethod( - Invocation.getter(#product), - returnValue: '', - ) as String); - - @override - String get userAgent => (super.noSuchMethod( - Invocation.getter(#userAgent), - returnValue: '', - ) as String); - - @override - List<_i2.Gamepad?> getGamepads() => (super.noSuchMethod( - Invocation.method( - #getGamepads, - [], - ), - returnValue: <_i2.Gamepad?>[], - ) as List<_i2.Gamepad?>); - - @override - _i3.Future<_i2.MediaStream> getUserMedia({ - dynamic audio = false, - dynamic video = false, - }) => - (super.noSuchMethod( - Invocation.method( - #getUserMedia, - [], - { - #audio: audio, - #video: video, - }, - ), - returnValue: _i3.Future<_i2.MediaStream>.value(_FakeMediaStream_14( - this, - Invocation.method( - #getUserMedia, - [], - { - #audio: audio, - #video: video, - }, - ), - )), - ) as _i3.Future<_i2.MediaStream>); - - @override - void cancelKeyboardLock() => super.noSuchMethod( - Invocation.method( - #cancelKeyboardLock, - [], - ), - returnValueForMissingStub: null, - ); - - @override - _i3.Future getBattery() => (super.noSuchMethod( - Invocation.method( - #getBattery, - [], - ), - returnValue: _i3.Future.value(), - ) as _i3.Future); - - @override - _i3.Future<_i2.RelatedApplication> getInstalledRelatedApps() => - (super.noSuchMethod( - Invocation.method( - #getInstalledRelatedApps, - [], - ), - returnValue: - _i3.Future<_i2.RelatedApplication>.value(_FakeRelatedApplication_15( - this, - Invocation.method( - #getInstalledRelatedApps, - [], - ), - )), - ) as _i3.Future<_i2.RelatedApplication>); - - @override - _i3.Future getVRDisplays() => (super.noSuchMethod( - Invocation.method( - #getVRDisplays, - [], - ), - returnValue: _i3.Future.value(), - ) as _i3.Future); - - @override - void registerProtocolHandler( - String? scheme, - String? url, - String? title, - ) => - super.noSuchMethod( - Invocation.method( - #registerProtocolHandler, - [ - scheme, - url, - title, - ], - ), - returnValueForMissingStub: null, - ); - - @override - _i3.Future requestKeyboardLock([List? keyCodes]) => - (super.noSuchMethod( - Invocation.method( - #requestKeyboardLock, - [keyCodes], - ), - returnValue: _i3.Future.value(), - ) as _i3.Future); - - @override - _i3.Future requestMidiAccess([Map? options]) => - (super.noSuchMethod( - Invocation.method( - #requestMidiAccess, - [options], - ), - returnValue: _i3.Future.value(), - ) as _i3.Future); - - @override - _i3.Future requestMediaKeySystemAccess( - String? keySystem, - List>? supportedConfigurations, - ) => - (super.noSuchMethod( - Invocation.method( - #requestMediaKeySystemAccess, - [ - keySystem, - supportedConfigurations, - ], - ), - returnValue: _i3.Future.value(), - ) as _i3.Future); - - @override - bool sendBeacon( - String? url, - Object? data, - ) => - (super.noSuchMethod( - Invocation.method( - #sendBeacon, - [ - url, - data, - ], - ), - returnValue: false, - ) as bool); - - @override - _i3.Future share([Map? data]) => - (super.noSuchMethod( - Invocation.method( - #share, - [data], - ), - returnValue: _i3.Future.value(), - ) as _i3.Future); } diff --git a/packages/url_launcher/url_launcher_web/example/pubspec.yaml b/packages/url_launcher/url_launcher_web/example/pubspec.yaml index d0964233150..4410f83ab08 100644 --- a/packages/url_launcher/url_launcher_web/example/pubspec.yaml +++ b/packages/url_launcher/url_launcher_web/example/pubspec.yaml @@ -19,3 +19,4 @@ dev_dependencies: url_launcher_platform_interface: ^2.2.0 url_launcher_web: path: ../ + web: '>=0.3.0 <0.5.0' diff --git a/packages/url_launcher/url_launcher_web/lib/src/link.dart b/packages/url_launcher/url_launcher_web/lib/src/link.dart index b1589ba8899..b2217fafb80 100644 --- a/packages/url_launcher/url_launcher_web/lib/src/link.dart +++ b/packages/url_launcher/url_launcher_web/lib/src/link.dart @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:html' as html; import 'dart:js_util'; import 'dart:ui_web' as ui_web; @@ -13,6 +12,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; import 'package:url_launcher_platform_interface/link.dart'; +import 'package:web/helpers.dart' as html; /// The unique identifier for the view type to be used for link platform views. const String linkViewType = '__url_launcher::link'; @@ -104,7 +104,11 @@ class LinkViewController extends PlatformViewController { if (_instances.isEmpty) { // This is the first controller being created, attach the global click // listener. - _clickSubscription = html.window.onClick.listen(_onGlobalClick); + + _clickSubscription = + const html.EventStreamProvider('click') + .forTarget(html.window) + .listen(_onGlobalClick); } _instances[viewId] = this; } @@ -164,10 +168,10 @@ class LinkViewController extends PlatformViewController { @override final int viewId; - late html.Element _element; + late html.HTMLElement _element; Future _initialize() async { - _element = html.Element.tag('a'); + _element = html.document.createElement('a') as html.HTMLElement; setProperty(_element, linkViewIdProperty, viewId); _element.style ..opacity = '0' diff --git a/packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart b/packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart index 0dd1012f708..070852db4c3 100644 --- a/packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart +++ b/packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart @@ -3,13 +3,13 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:html' as html; import 'dart:ui_web' as ui_web; import 'package:flutter/foundation.dart' show kDebugMode, visibleForTesting; import 'package:flutter_web_plugins/flutter_web_plugins.dart' show Registrar; import 'package:url_launcher_platform_interface/link.dart'; import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; +import 'package:web/web.dart' as html; import 'src/link.dart'; @@ -68,7 +68,7 @@ class UrlLauncherPlugin extends UrlLauncherPlatform { /// /// Returns the newly created window. @visibleForTesting - html.WindowBase? openNewWindow(String url, {String? webOnlyWindowName}) { + html.Window? openNewWindow(String url, {String? webOnlyWindowName}) { final String? scheme = _getUrlScheme(url); // Actively disallow opening some schemes, like javascript. // See https://github.com/flutter/flutter/issues/136657 diff --git a/packages/url_launcher/url_launcher_web/pubspec.yaml b/packages/url_launcher/url_launcher_web/pubspec.yaml index b70a09439e7..0c3b8ea0821 100644 --- a/packages/url_launcher/url_launcher_web/pubspec.yaml +++ b/packages/url_launcher/url_launcher_web/pubspec.yaml @@ -2,11 +2,11 @@ name: url_launcher_web description: Web platform implementation of url_launcher repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 -version: 2.2.0 +version: 2.2.1 environment: - sdk: ">=3.1.0 <4.0.0" - flutter: ">=3.13.0" + sdk: ^3.2.0 + flutter: ">=3.16.0" flutter: plugin: @@ -22,6 +22,7 @@ dependencies: flutter_web_plugins: sdk: flutter url_launcher_platform_interface: ^2.2.0 + web: '>=0.3.0 <0.5.0' dev_dependencies: flutter_test: diff --git a/script/configs/allowed_unpinned_deps.yaml b/script/configs/allowed_unpinned_deps.yaml index 2c2345da9ae..fe4c138b0a6 100644 --- a/script/configs/allowed_unpinned_deps.yaml +++ b/script/configs/allowed_unpinned_deps.yaml @@ -51,6 +51,7 @@ - test_api - vm_service - wasm +- web - yaml # Google-owned packages - _discoveryapis_commons diff --git a/script/tool/lib/src/common/core.dart b/script/tool/lib/src/common/core.dart index 5e96c6214b2..2910301cda9 100644 --- a/script/tool/lib/src/common/core.dart +++ b/script/tool/lib/src/common/core.dart @@ -68,6 +68,7 @@ final Map _dartSdkForFlutterSdk = { Version(3, 10, 0): Version(3, 0, 0), Version(3, 10, 6): Version(3, 0, 6), Version(3, 13, 0): Version(3, 1, 0), + Version(3, 16, 0): Version(3, 2, 0), }; /// Returns the version of the Dart SDK that shipped with the given Flutter