【发布时间】:2019-05-12 21:16:42
【问题描述】:
我在颤振项目中使用 VS Code。我刚刚编辑了 pubspec.yaml 以指向更高版本的包,它会自动运行“flutter packages get”。在我的“/development//flutter/.pub-cache/hosted/pub.dartlang.org”目录中,我可以看到这两个版本。但是当我编译时,它看起来仍在使用旧版本。我尝试了各种方法,例如“flutter packages upgrade”、“flutter clean”等,但无济于事。查看 2 个包版本的源代码,我可以在较新的版本中看到我想要的更改。我如何指向新包?谢谢。
更新:
这是没有更新的“以太坊”包。我使用的是 3.0.0 版本(方法需要 2 个参数),然后切换到 3.1.0 版本(方法需要 3 个参数)。但是使用 3 arg 调用编译时参数计数不正确:
client.admin.personalSendTransaction(BigInt.parse(currentAddress), currentPassword,{});
[dart] Too many positional arguments: 2 expected, but 3 found. [extra_positional_arguments_could_be_named]
然而,将鼠标悬停在方法调用上确实表明它需要 3 个参数:
personalSendTransaction(BigInt address, String passphrase, {BigInt to, BigInt data, int gas, int gasPrice, int value, int nonce, int condition, bool conditionIsTimestamp: false}) → Future<BigInt>
pubspec.yaml:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
# Get package(s) for talking to ethereum node
# web3dart: '>=0.3.0'
ethereum: ^3.1.0
# read barcodes and QR codes
barcode_scan: ^0.0.3
# Generate a QR code
qr: ^1.0.1
# Display as actual symbol
qr_flutter: ^1.1.5
dev_dependencies:
flutter_test:
sdk: flutter
在 pubspec.lock 中:
ethereum:
dependency: "direct main"
description:
name: ethereum
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
版本 3.1.0 是我想要使用的。
运行 'flutter packages upgrade resolved' 产量:
[Gregorys-iMac]:(gkd) ~/Programs/wine_track $ flutter packages upgrade resolved
Running "flutter packages upgrade" in .... 2.7s
在包缓存中,我两者都有:
/Users/gkd/development//flutter/.pub-cache/hosted/pub.dartlang.org/ethereum-3.0.0/lib/src/api/ethereum_api_admin.dart
/Users/gkd/development//flutter/.pub-cache/hosted/pub.dartlang.org/ethereum-3.1.0/lib/src/api/ethereum_api_admin.dart
【问题讨论】:
-
您能在问题中添加您的 pubspec 文件吗?什么包没有更新?
-
查看
pubspec.lock文件是什么版本flutter packages upgrade resolved. What exactly does the dependency looks like that you added topubspec.yaml`?
标签: visual-studio-code flutter