From fbd05ac76be265b70595627a14a21574e192ae27 Mon Sep 17 00:00:00 2001 From: WWTS <57695674+wwtssu@users.noreply.github.com> Date: Tue, 16 Sep 2025 12:55:18 +0900 Subject: [PATCH] fixed file.dart writeAsBytes --- lib/src/eval/shared/stdlib/io/file.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/eval/shared/stdlib/io/file.dart b/lib/src/eval/shared/stdlib/io/file.dart index a21bfce..a2cd0a3 100644 --- a/lib/src/eval/shared/stdlib/io/file.dart +++ b/lib/src/eval/shared/stdlib/io/file.dart @@ -582,7 +582,7 @@ class $File implements $Instance { static $Value? __writeAsBytes( Runtime runtime, $Value? target, List<$Value?> args) { final entity = target!.$value as File; - final bytes = args[0]!.$value as List; + final bytes = (args[0]!.$value as List).map((v) => (v as $int).$value).toList(); //final mode = args[1]!.$value as FileMode; runtime.assertPermission('filesystem:write', entity.path); return $Future.wrap(entity.writeAsBytes(bytes /*, mode: mode*/)); @@ -593,7 +593,7 @@ class $File implements $Instance { static $Value? __writeAsBytesSync( Runtime runtime, $Value? target, List<$Value?> args) { final entity = target!.$value as File; - final bytes = args[0]!.$value as List; + final bytes = (args[0]!.$value as List).map((v) => (v as $int).$value).toList(); //final mode = args[1]!.$value as FileMode; runtime.assertPermission('filesystem:write', entity.path); entity.writeAsBytesSync(bytes /*, mode: mode*/);