dart-sdk/sdk/lib
Martin Kustermann 81df36216f Make utf8.encode() have Uint8List return type
Right now `utf8.encode()` has a static return type of `List<int>`
due to extending `Encoding` (which extends `Codec<String, List<int>>`).

We cannot easily change `Encoding` to extend `Codec<String, Uint8List>`
because that would also change `utf8.decode()` to require `Uint8List`
which would be a breaking change.

So instead we override `utf8.encode()` to have more precise return type.

Some parts of our SDK are run using the checked-in SDK, so it cannot
rely on the changed return type yet (until checked-in SDK is rolled).

So we use `const Utf8Encoder().convert()` as a temporary change, as
that already has `Uint8List` return type.

Issue https://github.com/dart-lang/sdk/issues/52801

TEST=ci

CoreLibraryReviewExempt: More precise return type for existing API
Change-Id: I2861d1f0eb3d292d8e3ec8437c0d441a2d2bd193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254903
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-07-11 08:54:33 +00:00
..
_http
_internal [js|dart2wasm] Add JS backed subtypes of Dart typed array classes. 2023-07-10 18:11:02 +00:00
_wasm
async [vm] Rework awaiter stack unwinding. 2023-06-30 14:03:03 +00:00
cli
collection Add a notice about HashMap keys changing hashCode 2023-06-23 00:10:19 +00:00
convert Make utf8.encode() have Uint8List return type 2023-07-11 08:54:33 +00:00
core Mention iteration depth for some Iterable methods 2023-06-22 20:44:09 +00:00
developer Support the dart:developer timeline APIs in dart2js and DDC. 2023-06-30 22:38:11 +00:00
ffi [vm] Async FFI callbacks 2023-06-28 01:00:18 +00:00
html Reland "[dart:html] Throw exception if Window.open opens null window" and 2023-07-06 15:50:48 +00:00
indexed_db/dart2js
internal
io Mention that IOSink truncates List<int> to bytes 2023-06-27 19:39:01 +00:00
isolate
js
js_interop
js_interop_unsafe
js_util
math
mirrors
svg/dart2js
typed_data
vmservice
web_audio/dart2js
web_gl/dart2js
web_sql/dart2js
analysis_options.yaml
libraries.json [js] Add JSStringImpl box for JSString. 2023-06-26 17:15:24 +00:00
libraries.yaml [js] Add JSStringImpl box for JSString. 2023-06-26 17:15:24 +00:00
PRESUBMIT.py
vmservice_libraries.json
vmservice_libraries.yaml