Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c6092c3

Browse files
Manual roll of Dart SDK from 82c4571bb2de to a677378ae254 (#48933)
Includes type annotations for JSArray/JSPromise (see https://dart-review.googlesource.com/c/sdk/+/337923)
1 parent 5603ac8 commit c6092c3

File tree

11 files changed

+56
-55
lines changed

11 files changed

+56
-55
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ vars = {
6666
# Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS
6767
# You can use //tools/dart/create_updated_flutter_deps.py to produce
6868
# updated revision list of existing dependencies.
69-
'dart_revision': '82c4571bb2ded15cca71862158f2a7a78ee9127f',
69+
'dart_revision': 'a677378ae25424f8e74b2f750e879458e9a17488',
7070

7171
# WARNING: DO NOT EDIT MANUALLY
7272
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py

ci/licenses_golden/licenses_dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: fa0827b53a214003c14110498dcee743
1+
Signature: 9566e23501be49ccdb4d0e710a9b74e7
22

33
====================================================================================================
44
LIBRARY: dart

lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,23 +2942,23 @@ extension SkTextStylePropertiesExtension on SkTextStyleProperties {
29422942
external set fontStyle(SkFontStyle? value);
29432943

29442944
@JS('shadows')
2945-
external set _shadows(JSArray? value);
2945+
external set _shadows(JSArray<JSAny?>? value);
29462946
set shadows(List<SkTextShadow>? value) =>
29472947
// TODO(joshualitt): remove this cast when we reify JS types on JS
29482948
// backends.
29492949
// ignore: unnecessary_cast
29502950
_shadows = (value as List<JSAny>?)?.toJS;
29512951

29522952
@JS('fontFeatures')
2953-
external set _fontFeatures(JSArray? value);
2953+
external set _fontFeatures(JSArray<JSAny?>? value);
29542954
set fontFeatures(List<SkFontFeature>? value) =>
29552955
// TODO(joshualitt): remove this cast when we reify JS types on JS
29562956
// backends.
29572957
// ignore: unnecessary_cast
29582958
_fontFeatures = (value as List<JSAny>?)?.toJS;
29592959

29602960
@JS('fontVariations')
2961-
external set _fontVariations(JSArray? value);
2961+
external set _fontVariations(JSArray<JSAny?>? value);
29622962
set fontVariations(List<SkFontVariation>? value) =>
29632963
// TODO(joshualitt): remove this cast when we reify JS types on JS
29642964
// backends.
@@ -3200,7 +3200,7 @@ class SkGlyphClusterInfo {}
32003200

32013201
extension SkGlyphClusterInfoExtension on SkGlyphClusterInfo {
32023202
@JS('graphemeLayoutBounds')
3203-
external JSArray get _bounds;
3203+
external JSArray<JSAny?> get _bounds;
32043204

32053205
@JS('dir')
32063206
external SkTextDirection get _direction;
@@ -3256,7 +3256,7 @@ extension SkParagraphExtension on SkParagraph {
32563256
double getIdeographicBaseline() => _getIdeographicBaseline().toDartDouble;
32573257

32583258
@JS('getLineMetrics')
3259-
external JSArray _getLineMetrics();
3259+
external JSArray<JSAny?> _getLineMetrics();
32603260
List<SkLineMetrics> getLineMetrics() =>
32613261
_getLineMetrics().toDart.cast<SkLineMetrics>();
32623262

@@ -3289,7 +3289,7 @@ extension SkParagraphExtension on SkParagraph {
32893289
double getMaxWidth() => _getMaxWidth().toDartDouble;
32903290

32913291
@JS('getRectsForRange')
3292-
external JSArray _getRectsForRange(
3292+
external JSArray<JSAny?> _getRectsForRange(
32933293
JSNumber start,
32943294
JSNumber end,
32953295
SkRectHeightStyle heightStyle,
@@ -3304,7 +3304,7 @@ extension SkParagraphExtension on SkParagraph {
33043304
widthStyle).toDart.cast<SkRectWithDirection>();
33053305

33063306
@JS('getRectsForPlaceholders')
3307-
external JSArray _getRectsForPlaceholders();
3307+
external JSArray<JSAny?> _getRectsForPlaceholders();
33083308
List<SkRectWithDirection> getRectsForPlaceholders() =>
33093309
_getRectsForPlaceholders().toDart.cast<SkRectWithDirection>();
33103310

lib/web_ui/lib/src/engine/canvaskit/image_web_codecs.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Future<ByteBuffer> readVideoFramePixelsUnmodified(VideoFrame videoFrame) async {
142142
// In dart2wasm, Uint8List is not the same as a JS Uint8Array. So we
143143
// explicitly construct the JS object here.
144144
final JSUint8Array destination = createUint8ArrayFromLength(size);
145-
final JSPromise copyPromise = videoFrame.copyTo(destination);
145+
final JSPromise<JSAny?> copyPromise = videoFrame.copyTo(destination);
146146
await promiseToFuture<void>(copyPromise);
147147

148148
// In dart2wasm, `toDart` incurs a copy here. On JS backends, this is a

lib/web_ui/lib/src/engine/dom.dart

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ extension DomWindowExtension on DomWindow {
110110
}
111111

112112
@JS('fetch')
113-
external JSPromise _fetch1(JSString url);
113+
external JSPromise<JSAny?> _fetch1(JSString url);
114114
@JS('fetch')
115-
external JSPromise _fetch2(JSString url, JSAny headers);
115+
external JSPromise<JSAny?> _fetch2(JSString url, JSAny headers);
116116

117117
// ignore: non_constant_identifier_names
118118
external DomURL get URL;
@@ -149,7 +149,7 @@ extension DomWindowExtension on DomWindow {
149149
external JSVoid _postMessage1(JSAny message, JSString targetOrigin);
150150
@JS('postMessage')
151151
external JSVoid _postMessage2(
152-
JSAny message, JSString targetOrigin, JSArray messagePorts);
152+
JSAny message, JSString targetOrigin, JSArray<JSAny?> messagePorts);
153153
void postMessage(Object message, String targetOrigin,
154154
[List<DomMessagePort>? messagePorts]) {
155155
if (messagePorts == null) {
@@ -199,18 +199,18 @@ external DomIntl get domIntl;
199199
external DomSymbol get domSymbol;
200200

201201
@JS('createImageBitmap')
202-
external JSPromise _createImageBitmap1(
202+
external JSPromise<JSAny?> _createImageBitmap1(
203203
JSAny source,
204204
);
205205
@JS('createImageBitmap')
206-
external JSPromise _createImageBitmap2(
206+
external JSPromise<JSAny?> _createImageBitmap2(
207207
JSAny source,
208208
JSNumber x,
209209
JSNumber y,
210210
JSNumber width,
211211
JSNumber height,
212212
);
213-
JSPromise createImageBitmap(JSAny source,
213+
JSPromise<JSAny?> createImageBitmap(JSAny source,
214214
[({int x, int y, int width, int height})? bounds]) {
215215
if (bounds != null) {
216216
return _createImageBitmap2(source, bounds.x.toJS, bounds.y.toJS,
@@ -248,7 +248,7 @@ extension DomNavigatorExtension on DomNavigator {
248248
String get userAgent => _userAgent.toDart;
249249

250250
@JS('languages')
251-
external JSArray? get _languages;
251+
external JSArray<JSAny?>? get _languages;
252252
List<String>? get languages => _languages?.toDart
253253
.map<String>((JSAny? any) => (any! as JSString).toDart)
254254
.toList();
@@ -947,7 +947,7 @@ extension DomHTMLImageElementExtension on DomHTMLImageElement {
947947
set height(double? value) => _height = value?.toJS;
948948

949949
@JS('decode')
950-
external JSPromise _decode();
950+
external JSPromise<JSAny?> _decode();
951951
Future<Object?> decode() => js_util.promiseToFuture<Object?>(_decode());
952952
}
953953

@@ -1886,16 +1886,16 @@ extension DomResponseExtension on DomResponse {
18861886
external _DomReadableStream get body;
18871887

18881888
@JS('arrayBuffer')
1889-
external JSPromise _arrayBuffer();
1889+
external JSPromise<JSAny?> _arrayBuffer();
18901890
Future<Object?> arrayBuffer() =>
18911891
js_util.promiseToFuture<Object?>(_arrayBuffer());
18921892

18931893
@JS('json')
1894-
external JSPromise _json();
1894+
external JSPromise<JSAny?> _json();
18951895
Future<Object?> json() => js_util.promiseToFuture<Object?>(_json());
18961896

18971897
@JS('text')
1898-
external JSPromise _text();
1898+
external JSPromise<JSAny?> _text();
18991899
Future<String> text() => js_util.promiseToFuture<String>(_text());
19001900
}
19011901

@@ -1923,7 +1923,7 @@ class _DomStreamReader {}
19231923

19241924
extension _DomStreamReaderExtension on _DomStreamReader {
19251925
@JS('read')
1926-
external JSPromise _read();
1926+
external JSPromise<JSAny?> _read();
19271927
Future<_DomStreamChunk> read() =>
19281928
js_util.promiseToFuture<_DomStreamChunk>(_read());
19291929
}
@@ -2045,7 +2045,7 @@ DomFontFace createDomFontFace(String family, Object source,
20452045

20462046
extension DomFontFaceExtension on DomFontFace {
20472047
@JS('load')
2048-
external JSPromise _load();
2048+
external JSPromise<JSAny?> _load();
20492049
Future<DomFontFace> load() => js_util.promiseToFuture(_load());
20502050

20512051
@JS('family')
@@ -2166,11 +2166,11 @@ class DomClipboard extends DomEventTarget {}
21662166

21672167
extension DomClipboardExtension on DomClipboard {
21682168
@JS('readText')
2169-
external JSPromise _readText();
2169+
external JSPromise<JSAny?> _readText();
21702170
Future<String> readText() => js_util.promiseToFuture<String>(_readText());
21712171

21722172
@JS('writeText')
2173-
external JSPromise _writeText(JSString data);
2173+
external JSPromise<JSAny?> _writeText(JSString data);
21742174
Future<dynamic> writeText(String data) =>
21752175
js_util.promiseToFuture(_writeText(data.toJS));
21762176
}
@@ -2340,26 +2340,26 @@ extension DomURLExtension on DomURL {
23402340
@JS('Blob')
23412341
@staticInterop
23422342
class DomBlob {
2343-
external factory DomBlob(JSArray parts);
2343+
external factory DomBlob(JSArray<JSAny?> parts);
23442344

2345-
external factory DomBlob.withOptions(JSArray parts, JSAny options);
2345+
external factory DomBlob.withOptions(JSArray<JSAny?> parts, JSAny options);
23462346
}
23472347

23482348
extension DomBlobExtension on DomBlob {
2349-
external JSPromise arrayBuffer();
2349+
external JSPromise<JSAny?> arrayBuffer();
23502350
}
23512351

23522352
DomBlob createDomBlob(List<Object?> parts, [Map<String, dynamic>? options]) {
23532353
if (options == null) {
2354-
return DomBlob(parts.toJSAnyShallow as JSArray);
2354+
return DomBlob(parts.toJSAnyShallow as JSArray<JSAny?>);
23552355
} else {
23562356
return DomBlob.withOptions(
2357-
parts.toJSAnyShallow as JSArray, options.toJSAnyDeep);
2357+
parts.toJSAnyShallow as JSArray<JSAny?>, options.toJSAnyDeep);
23582358
}
23592359
}
23602360

23612361
typedef DomMutationCallback = void Function(
2362-
JSArray mutation, DomMutationObserver observer);
2362+
JSArray<JSAny?> mutation, DomMutationObserver observer);
23632363

23642364
@JS('MutationObserver')
23652365
@staticInterop
@@ -2565,7 +2565,7 @@ extension DomPointerEventExtension on DomPointerEvent {
25652565
double? get tiltY => _tiltY?.toDartDouble;
25662566

25672567
@JS('getCoalescedEvents')
2568-
external JSArray _getCoalescedEvents();
2568+
external JSArray<JSAny?> _getCoalescedEvents();
25692569
List<DomPointerEvent> getCoalescedEvents() =>
25702570
_getCoalescedEvents().toDart.cast<DomPointerEvent>();
25712571
}
@@ -2886,11 +2886,11 @@ extension DomOffscreenCanvasExtension on DomOffscreenCanvas {
28862886
}
28872887

28882888
@JS('convertToBlob')
2889-
external JSPromise _convertToBlob1();
2889+
external JSPromise<JSAny?> _convertToBlob1();
28902890
@JS('convertToBlob')
2891-
external JSPromise _convertToBlob2(JSAny options);
2891+
external JSPromise<JSAny?> _convertToBlob2(JSAny options);
28922892
Future<DomBlob> convertToBlob([Map<Object?, Object?>? options]) {
2893-
final JSPromise blob;
2893+
final JSPromise<JSAny?> blob;
28942894
if (options == null) {
28952895
blob = _convertToBlob1();
28962896
} else {
@@ -3013,7 +3013,7 @@ class DomScreenOrientation extends DomEventTarget {}
30133013

30143014
extension DomScreenOrientationExtension on DomScreenOrientation {
30153015
@JS('lock')
3016-
external JSPromise _lock(JSString orientation);
3016+
external JSPromise<JSAny?> _lock(JSString orientation);
30173017
Future<dynamic> lock(String orientation) =>
30183018
js_util.promiseToFuture(_lock(orientation.toJS));
30193019

@@ -3163,7 +3163,7 @@ abstract class DomResizeObserver {
31633163
/// Internally converts the `List<dynamic>` of entries into the expected
31643164
/// `List<DomResizeObserverEntry>`
31653165
DomResizeObserver? createDomResizeObserver(DomResizeObserverCallbackFn fn) =>
3166-
DomResizeObserver((JSArray entries, DomResizeObserver observer) {
3166+
DomResizeObserver((JSArray<JSAny?> entries, DomResizeObserver observer) {
31673167
fn(entries.toDart.cast<DomResizeObserverEntry>(), observer);
31683168
}.toJS);
31693169

@@ -3480,7 +3480,7 @@ class DomSegmenter {
34803480
// TODO(joshualitt): `locales` should really be typed as `JSAny?`, and we
34813481
// should pass `JSUndefined`. Revisit this after we reify `JSUndefined` on
34823482
// Dart2Wasm.
3483-
external factory DomSegmenter(JSArray locales, JSAny options);
3483+
external factory DomSegmenter(JSArray<JSAny?> locales, JSAny options);
34843484
}
34853485

34863486
extension DomSegmenterExtension on DomSegmenter {
@@ -3580,7 +3580,7 @@ DomSegmenter createIntlSegmenter({required String granularity}) {
35803580
@JS('Intl.v8BreakIterator')
35813581
@staticInterop
35823582
class DomV8BreakIterator {
3583-
external factory DomV8BreakIterator(JSArray locales, JSAny options);
3583+
external factory DomV8BreakIterator(JSArray<JSAny?> locales, JSAny options);
35843584
}
35853585

35863586
extension DomV8BreakIteratorExtension on DomV8BreakIterator {
@@ -3679,7 +3679,7 @@ bool get browserSupportsCreateImageBitmap =>
36793679

36803680
@JS()
36813681
@staticInterop
3682-
extension JSArrayExtension on JSArray {
3682+
extension JSArrayExtension on JSArray<JSAny?> {
36833683
external void push(JSAny value);
36843684
external JSNumber get length;
36853685
}

lib/web_ui/lib/src/engine/js_interop/js_promise.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ extension CallExtension on JSFunction {
1818
@JS('Promise')
1919
external JSAny get _promiseConstructor;
2020

21-
JSPromise createPromise(JSFunction executor) =>
21+
JSPromise<JSAny?> createPromise(JSFunction executor) =>
2222
js_util.callConstructor(
2323
_promiseConstructor,
2424
<Object>[executor],
2525
);
2626

2727

28-
JSPromise futureToPromise<T extends JSAny?>(Future<T> future) {
28+
JSPromise<JSAny?> futureToPromise<T extends JSAny?>(Future<T> future) {
2929
return createPromise((JSFunction resolver, JSFunction rejecter) {
3030
future.then(
3131
(T value) => resolver.call(null, value),

lib/web_ui/lib/src/engine/platform_dispatcher.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,8 +986,8 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher {
986986
void _addFontSizeObserver() {
987987
const String styleAttribute = 'style';
988988

989-
_fontSizeObserver =
990-
createDomMutationObserver((JSArray mutations, DomMutationObserver _) {
989+
_fontSizeObserver = createDomMutationObserver(
990+
(JSArray<JSAny?> mutations, DomMutationObserver _) {
991991
for (final JSAny? mutation in mutations.toDart) {
992992
final DomMutationRecord record = mutation! as DomMutationRecord;
993993
if (record.type == 'attributes' &&

lib/web_ui/lib/src/engine/safe_browser_api.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ extension ImageDecoderExtension on ImageDecoder {
214214
external JSBoolean get _complete;
215215
bool get complete => _complete.toDart;
216216

217-
external JSPromise decode(DecodeOptions options);
217+
external JSPromise<JSAny?> decode(DecodeOptions options);
218218
external JSVoid close();
219219
}
220220

@@ -288,8 +288,9 @@ extension VideoFrameExtension on VideoFrame {
288288
double allocationSize() => _allocationSize().toDartDouble;
289289

290290
@JS('copyTo')
291-
external JSPromise _copyTo(JSAny destination);
292-
JSPromise copyTo(Object destination) => _copyTo(destination.toJSAnyShallow);
291+
external JSPromise<JSAny?> _copyTo(JSAny destination);
292+
JSPromise<JSAny?> copyTo(Object destination) =>
293+
_copyTo(destination.toJSAnyShallow);
293294

294295
@JS('format')
295296
external JSString? get _format;
@@ -330,7 +331,7 @@ extension VideoFrameExtension on VideoFrame {
330331
class ImageTrackList {}
331332

332333
extension ImageTrackListExtension on ImageTrackList {
333-
external JSPromise get ready;
334+
external JSPromise<JSAny?> get ready;
334335
external ImageTrack? get selectedTrack;
335336
}
336337

lib/web_ui/lib/src/engine/view_embedder/hot_restart_cache_handler.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import '../dom.dart';
1313
/// to clear. Delay removal of old visible state to make the
1414
/// transition appear smooth.
1515
@JS('window.__flutterState')
16-
external JSArray? get _jsHotRestartStore;
16+
external JSArray<JSAny?>? get _jsHotRestartStore;
1717

1818
@JS('window.__flutterState')
19-
external set _jsHotRestartStore(JSArray? nodes);
19+
external set _jsHotRestartStore(JSArray<JSAny?>? nodes);
2020

2121
/// Handles [DomElement]s that need to be removed after a hot-restart.
2222
///
@@ -36,7 +36,7 @@ class HotRestartCacheHandler {
3636
/// Removes every element that was registered prior to the hot-restart from
3737
/// the DOM.
3838
void _resetHotRestartStore() {
39-
final JSArray? jsStore = _jsHotRestartStore;
39+
final JSArray<JSAny?>? jsStore = _jsHotRestartStore;
4040

4141
if (jsStore != null) {
4242
// We are in a post hot-restart world, clear the elements now.
@@ -47,7 +47,7 @@ class HotRestartCacheHandler {
4747
}
4848
}
4949
}
50-
_jsHotRestartStore = JSArray();
50+
_jsHotRestartStore = JSArray<JSAny?>();
5151
}
5252

5353
/// Registers a [DomElement] to be removed after hot-restart.

lib/web_ui/test/engine/surface/scene_builder_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ void testMain() {
487487

488488
// Watches DOM mutations and counts deletions and additions to the child
489489
// list of the `<flt-scene>` element.
490-
final DomMutationObserver observer = createDomMutationObserver((JSArray mutations, _) {
490+
final DomMutationObserver observer = createDomMutationObserver((JSArray<JSAny?> mutations, _) {
491491
for (final DomMutationRecord record in mutations.toDart.cast<DomMutationRecord>()) {
492492
actualDeletions.addAll(record.removedNodes!);
493493
actualAdditions.addAll(record.addedNodes!);

0 commit comments

Comments
 (0)