unpub icon indicating copy to clipboard operation
unpub copied to clipboard

'String?' is nullable and 'Object' isn't.

Open Peibalam opened this issue 2 years ago • 7 comments

../../../.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"

Peibalam avatar Mar 29 '22 11:03 Peibalam

这个问题解决了吗

../../../.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"

LouisShark avatar Apr 11 '22 09:04 LouisShark

要下载源码修改才行,把String? 改为String

Peibalam avatar Apr 11 '22 09:04 Peibalam

要下载源码修改才行,把String? 改为String

@Peibalam 我把 String? 改了 String 还是会,改成 Object 也会~😓是遗漏了哪一步吗?

  • 研发一番发现问题了:我的根项目和 flutter 目录下的 .pub-cache 存在各自的一份 unpub-2.0.0 源码(个人猜测 dart 、 flutter 命令启动服务有关)。这块需要注意 😓

zeqinjie avatar May 03 '22 05:05 zeqinjie

Thats not really helpful

rdev-software avatar May 12 '22 08:05 rdev-software

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

fadeltd avatar Jun 14 '22 03:06 fadeltd

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

yes,after i modifying Line 103 from String? to String and delete your .pub-cache un-pub cache.

Peibalam avatar Jun 14 '22 03:06 Peibalam

There is already a pull request: https://github.com/bytedance/unpub/pull/85

Dampfwalze avatar Aug 04 '22 15:08 Dampfwalze