unpub
unpub copied to clipboard
'String?' is nullable and 'Object' isn't.
../../../.pub-cache/hosted/pub.flutter-io.cn/unpub-2.0.0/lib/src/app.dart:113:48: Error: The argument type 'String?' can't be assigned to the parameter type 'Object' because 'String?' is nullable and 'Object' isn't.
- 'Object' is from 'dart:core'. var server = await shelf_io.serve(handler, host, port);
dart version:Dart SDK version: 2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on "macos_x64"
这个问题解决了吗
../../../.pub-cache/hosted/pub.flutter-io.cn/unpub-2.0.0/lib/src/app.dart:113:48: Error: The argument type 'String?' can't be assigned to the parameter type 'Object' because 'String?' is nullable and 'Object' isn't.
- 'Object' is from 'dart:core'. var server = await shelf_io.serve(handler, host, port);
dart version:Dart SDK version: 2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on "macos_x64"
要下载源码修改才行,把String? 改为String
要下载源码修改才行,把String? 改为String
@Peibalam 我把 String? 改了 String 还是会,改成 Object 也会~😓是遗漏了哪一步吗?
- 研发一番发现问题了:我的根项目和 flutter 目录下的 .pub-cache 存在各自的一份 unpub-2.0.0 源码(个人猜测 dart 、 flutter 命令启动服务有关)。这块需要注意 😓
Thats not really helpful
Here's the current workaround, can run after modifying String?
to String
on https://github.com/bytedance/unpub/blob/54742c625d5b4820e353e62be298157c830ebc2f/unpub/bin/unpub.dart#L16 & https://github.com/bytedance/unpub/blob/54742c625d5b4820e353e62be298157c830ebc2f/unpub/lib/src/app.dart#L103
Here's the current workaround, can run after modifying
String?
toString
onhttps://github.com/bytedance/unpub/blob/54742c625d5b4820e353e62be298157c830ebc2f/unpub/bin/unpub.dart#L16
& https://github.com/bytedance/unpub/blob/54742c625d5b4820e353e62be298157c830ebc2f/unpub/lib/src/app.dart#L103
yes,after i modifying Line 103 from String? to String and delete your .pub-cache un-pub cache.
There is already a pull request: https://github.com/bytedance/unpub/pull/85