Skip to content

Commit

Permalink
Prepare for utf8.encode() to return more precise Uint8List type (#129769
Browse files Browse the repository at this point in the history
)

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

See dart-lang/sdk#52801
  • Loading branch information
mkustermann committed Jun 29, 2023
1 parent 7cab354 commit 7068a20
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/flutter_tools/lib/src/isolated/devfs_web.dart
Expand Up @@ -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) {
Expand Down
Expand Up @@ -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),
Expand Down

0 comments on commit 7068a20

Please sign in to comment.