Prepare for utf8.encode() to return more precise Uint8List type (#129769)

To avoid analyzer warnings when utf8.encode() will return the more
precise Uint8List type, we use const Utf8Encoder().convert() which
already returns Uint8List

See https://github.com/dart-lang/sdk/issues/52801
This commit is contained in:
Martin Kustermann 2023-06-29 22:44:57 +02:00 committed by GitHub
parent 7cab354def
commit 7068a2088e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -493,7 +493,7 @@ class WebAssetServer implements AssetReader {
/// Write a single file into the in-memory cache.
void writeFile(String filePath, String contents) {
writeBytes(filePath, utf8.encode(contents) as Uint8List);
writeBytes(filePath, const Utf8Encoder().convert(contents));
}
void writeBytes(String filePath, Uint8List contents) {

View File

@ -39,7 +39,7 @@ void main() {
unawaited(symbolizationService.decode(
input: Stream<Uint8List>.fromIterable(<Uint8List>[
utf8.encode('Hello, World\n') as Uint8List,
const Utf8Encoder().convert('Hello, World\n'),
]),
symbols: Uint8List(0),
output: IOSink(output.sink),