Reland "[dart:js_interop] Add Since('3.6') annotations to new APIs"
This reverts commit 7600900d78793a9c7177963eb3f30cd74edc5903.
Reason for revert: https://github.com/flutter/engine/pull/54626 has update the pubspecs for web_ui and web_sdk to include `3.6`.
Original change's description:
> Revert "[dart:js_interop] Add Since('3.6') annotations to new APIs"
>
> This reverts commit 14cf3b44d3e705c7ae1b450044c151f7f8a49c70.
>
> Reason for revert: web_ui uses some of these APIs, but the pubspec SDK version is not >= 3.6. Therefore, Flutter analyze fails, which would then result in a broken roll. Updating the pubspec versions leads to try bot failures (https://github.com/flutter/engine/pull/54590) so for now, revert.
>
> Original change's description:
> > [dart:js_interop] Add Since('3.6') annotations to new APIs
> >
> > Closes https://github.com/dart-lang/sdk/issues/56484
> >
> > Change-Id: I9d3da568aafeccbb855892ea5c2ba647371170bc
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380900
> > Reviewed-by: Kevin Moore <kevmoo@google.com>
> > Reviewed-by: Leaf Petersen <leafp@google.com>
> > Reviewed-by: Sigmund Cherem <sigmund@google.com>
> > Commit-Queue: Srujan Gaddam <srujzs@google.com>
> > Reviewed-by: Martin Kustermann <kustermann@google.com>
>
> Change-Id: Idfb021c5744d83a8004259f9c8774945a2612efd
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380967
> Reviewed-by: Leaf Petersen <leafp@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
Change-Id: I5c37640e06456d270db2adfd70283456bde671ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381308
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
diff --git a/sdk/lib/js_interop/js_interop.dart b/sdk/lib/js_interop/js_interop.dart
index 8fe6ccc..20eb6c1 100644
--- a/sdk/lib/js_interop/js_interop.dart
+++ b/sdk/lib/js_interop/js_interop.dart
@@ -160,18 +160,22 @@
external JSArray.withLength(int length);
/// The length in elements of this `Array`.
+ @Since('3.6')
external int get length;
/// Sets the length in elements of this `Array`.
///
/// Setting it smaller than the current length truncates this `Array`, and
/// setting it larger adds empty slots, which requires [T] to be nullable.
+ @Since('3.6')
external set length(int newLength);
/// The value at [position] in this `Array`.
+ @Since('3.6')
external T operator [](int position);
/// Sets the [value] at [position] in this `Array`.
+ @Since('3.6')
external void operator []=(int position, T value);
}
@@ -211,6 +215,7 @@
implements JSObject {
/// Creates a JavaScript `ArrayBuffer` of size [length] using an optional
/// [options] JavaScript object that sets the `maxByteLength`.
+ @Since('3.6')
external JSArrayBuffer(int length, [JSObject options]);
}
@@ -219,6 +224,7 @@
extension type JSDataView._(JSDataViewRepType _jsDataView) implements JSObject {
/// Creates a JavaScript `DataView` with [buffer] as its backing storage,
/// offset by [byteOffset] bytes, of size [byteLength].
+ @Since('3.6')
external JSDataView(JSArrayBuffer buffer, [int byteOffset, int byteLength]);
}
@@ -234,10 +240,12 @@
/// offset by [byteOffset] bytes, of size [length].
///
/// If no [buffer] is provided, creates an empty `Int8Array`.
+ @Since('3.6')
external JSInt8Array([JSArrayBuffer buffer, int byteOffset, int length]);
/// Creates a JavaScript `Int8Array` of size [length] whose elements are
/// initialized to 0.
+ @Since('3.6')
external JSInt8Array.withLength(int length);
}
@@ -249,10 +257,12 @@
/// offset by [byteOffset] bytes, of size [length].
///
/// If no [buffer] is provided, creates an empty `Uint8Array`.
+ @Since('3.6')
external JSUint8Array([JSArrayBuffer buffer, int byteOffset, int length]);
/// Creates a JavaScript `Uint8Array` of size [length] whose elements are
/// initialized to 0.
+ @Since('3.6')
external JSUint8Array.withLength(int length);
}
@@ -264,11 +274,13 @@
/// storage, offset by [byteOffset] bytes, of size [length].
///
/// If no [buffer] is provided, creates an empty `Uint8ClampedArray`.
+ @Since('3.6')
external JSUint8ClampedArray(
[JSArrayBuffer buffer, int byteOffset, int length]);
/// Creates a JavaScript `Uint8ClampedArray` of size [length] whose elements
/// are initialized to 0.
+ @Since('3.6')
external JSUint8ClampedArray.withLength(int length);
}
@@ -280,10 +292,12 @@
/// offset by [byteOffset] bytes, of size [length].
///
/// If no [buffer] is provided, creates an empty `Int16Array`.
+ @Since('3.6')
external JSInt16Array([JSArrayBuffer buffer, int byteOffset, int length]);
/// Creates a JavaScript `Int16Array` of size [length] whose elements are
/// initialized to 0.
+ @Since('3.6')
external JSInt16Array.withLength(int length);
}
@@ -295,10 +309,12 @@
/// offset by [byteOffset] bytes, of size [length].
///
/// If no [buffer] is provided, creates an empty `Uint16Array`.
+ @Since('3.6')
external JSUint16Array([JSArrayBuffer buffer, int byteOffset, int length]);
/// Creates a JavaScript `Uint16Array` of size [length] whose elements are
/// initialized to 0.
+ @Since('3.6')
external JSUint16Array.withLength(int length);
}
@@ -310,10 +326,12 @@
/// offset by [byteOffset] bytes, of size [length].
///
/// If no [buffer] is provided, creates an empty `Int32Array`.
+ @Since('3.6')
external JSInt32Array([JSArrayBuffer buffer, int byteOffset, int length]);
/// Creates a JavaScript `Int32Array` of size [length] whose elements are
/// initialized to 0.
+ @Since('3.6')
external JSInt32Array.withLength(int length);
}
@@ -325,10 +343,12 @@
/// offset by [byteOffset] bytes, of size [length].
///
/// If no [buffer] is provided, creates an empty `Uint32Array`.
+ @Since('3.6')
external JSUint32Array([JSArrayBuffer buffer, int byteOffset, int length]);
/// Creates a JavaScript `Uint32Array` of size [length] whose elements are
/// initialized to 0.
+ @Since('3.6')
external JSUint32Array.withLength(int length);
}
@@ -340,10 +360,12 @@
/// offset by [byteOffset] bytes, of size [length].
///
/// If no [buffer] is provided, creates an empty `Float32Array`.
+ @Since('3.6')
external JSFloat32Array([JSArrayBuffer buffer, int byteOffset, int length]);
/// Creates a JavaScript `Float32Array` of size [length] whose elements are
/// initialized to 0.
+ @Since('3.6')
external JSFloat32Array.withLength(int length);
}
@@ -355,10 +377,12 @@
/// offset by [byteOffset] bytes, of size [length].
///
/// If no [buffer] is provided, creates an empty `Float64Array`.
+ @Since('3.6')
external JSFloat64Array([JSArrayBuffer buffer, int byteOffset, int length]);
/// Creates a JavaScript `Float64Array` of size [length] whose elements are
/// initialized to 0.
+ @Since('3.6')
external JSFloat64Array.withLength(int length);
}
@@ -625,6 +649,7 @@
/// [Function]. Any [Function] that is converted with this member should take
/// in an extra parameter at the beginning of the parameter list to handle
/// this.
+ @Since('3.6')
external JSExportedDartFunction get toJSCaptureThis;
}