Unverified Commit 7068a208 authored by Martin Kustermann's avatar Martin Kustermann Committed by GitHub

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
parent 7cab354d
...@@ -493,7 +493,7 @@ class WebAssetServer implements AssetReader { ...@@ -493,7 +493,7 @@ class WebAssetServer implements AssetReader {
/// Write a single file into the in-memory cache. /// Write a single file into the in-memory cache.
void writeFile(String filePath, String contents) { 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) { void writeBytes(String filePath, Uint8List contents) {
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
unawaited(symbolizationService.decode( unawaited(symbolizationService.decode(
input: Stream<Uint8List>.fromIterable(<Uint8List>[ input: Stream<Uint8List>.fromIterable(<Uint8List>[
utf8.encode('Hello, World\n') as Uint8List, const Utf8Encoder().convert('Hello, World\n'),
]), ]),
symbols: Uint8List(0), symbols: Uint8List(0),
output: IOSink(output.sink), output: IOSink(output.sink),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment