Closed lambda-fairy closed 2 years ago
Target dart2js failed: Exception: ../.pub-cache/hosted/pub.dartlang.org/process-4.2.2/lib/src/interface/local_process_manager.dart:85:25: Error: The argument type 'Encoding?' can't be assigned to the parameter type 'Encoding' because 'Encoding?' is nullable and 'Encoding' isn't.
@topilski what Dart version are you running? process 4.2.2 requires >=2.12.0-0
I am facing same problem
My Dart Version: sdk: ">=2.12.0 <3.0.0"
$ flutter build web
💪 Building with sound null safety 💪
Target dart2js failed: Exception: ../../../Tools/flutter/.pub-cache/hosted/pub.dartlang.org/process-4.2.2/lib/src/interface/local_process_manager.dart:85:25:
Error: The argument type 'Encoding?' can't be assigned to the parameter type 'Encoding' because 'Encoding?' is nullable and 'Encoding' isn't.
- 'Encoding' is from 'dart:convert'.
stdoutEncoding: stdoutEncoding,
^
../../../Tools/flutter/.pub-cache/hosted/pub.dartlang.org/process-4.2.2/lib/src/interface/local_process_manager.dart:86:25:
Error: The argument type 'Encoding?' can't be assigned to the parameter type 'Encoding' because 'Encoding?' is nullable and 'Encoding' isn't.
- 'Encoding' is from 'dart:convert'.
stderrEncoding: stderrEncoding,
^
../../../Tools/flutter/.pub-cache/hosted/pub.dartlang.org/process-4.2.2/lib/src/interface/local_process_manager.dart:116:25:
Error: The argument type 'Encoding?' can't be assigned to the parameter type 'Encoding' because 'Encoding?' is nullable and 'Encoding' isn't.
- 'Encoding' is from 'dart:convert'.
stdoutEncoding: stdoutEncoding,
^
../../../Tools/flutter/.pub-cache/hosted/pub.dartlang.org/process-4.2.2/lib/src/interface/local_process_manager.dart:117:25:
Error: The argument type 'Encoding?' can't be assigned to the parameter type 'Encoding' because 'Encoding?' is nullable and 'Encoding' isn't.
- 'Encoding' is from 'dart:convert'.
stderrEncoding: stderrEncoding,
^
Error: Compilation failed.
Compiling lib/main.dart for the Web... 9.5s
Exception: Failed to compile application for the Web.
@vanshg395 @topilski what do you see for "Dart version" when you run flutter doctor -v
?
Aha, I see the issue.
In https://github.com/dart-lang/sdk/commit/d44457f79d087b52a0468609d44013e5fd9f09f0 (reviewed in https://dart-review.googlesource.com/c/sdk/+/151121), the encoding parameters to Process.run
and Process.runSync
were changed to be nullable. This change landed in Dart SDK 2.10. However, the change didn't update the web versions of those libraries (https://github.com/dart-lang/sdk/blob/cf5587e8612a3e19b9f622444572ab69fb9321ac/sdk/lib/_internal/js_runtime/lib/io_patch.dart#L361-L381).
So when compiling for web, the dart:io API is currently broken.
@leafpeterson
I'm gonna revert https://github.com/google/process.dart/pull/65 and publish that revert as process 4.2.3
Ok, the change has been reverted, and 4.2.3 has been published.
@vanshg395 @topilski you can update your packages, and the issue should be fixed.
FYI @lambda-fairy
I filed https://github.com/dart-lang/sdk/issues/46726 to track the fix needed in the Dart SDK
@topilski It works again. Thanks 👍
Hello @tvolkert thank you for fast fix, I will check!
The Dart SDK was fixed in https://github.com/dart-lang/sdk/commit/5de7dfb90bf1d006c64992938a9e2a2a0908d4d4. Once that's released to stable (and a stable version of Flutter contains the release as well), the fix to this issue can proceed.
That fix is in 2.14.0. I'm gonna try land this again 🙂
In the
dart:io
versions of theProcess.run
andrunSync
methods, thestderrEncoding
andstdoutEncoding
parameters are nullable. This library should be updated to match.Due to backward compatibility constraints, this has to be done in two phases:
covariant
keyword. This can be done in a patch release.covariant
. This requires a major release.