I'm using VS Code on a flutter project. I just edited pubspec.yaml to point to a later version of a package, and it automatically ran 'flutter packages get'. In my '/development//flutter/.pub-cache/hosted/pub.dartlang.org' directory, I can see both versions. But when I compile, it looks like it's still using the old version. I tried various things like 'flutter packages upgrade', 'flutter clean', etc., but to no avail. Looking at the 2 package versions' source code, I can see the change I want in the newer version. How do I point to the new package? Thanks.
Update:
It's the 'ethereum' package that's not updating. I had used the 3.0.0 version (method expects 2 args), and then switched to the 3.1.0 version (method expects 3 args). But compiling with a 3 arg call balks with incorrect argument count:
client.admin.personalSendTransaction(BigInt.parse(currentAddress), currentPassword,{});
[dart] Too many positional arguments: 2 expected, but 3 found. [extra_positional_arguments_could_be_named]
Yet hovering over the method call does show it expects 3 args:
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
In pubspec.lock:
ethereum:
dependency: "direct main"
description:
name: ethereum
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
Version 3.1.0 is what I want to be used.
Running 'flutter packages upgrade resolved' yields:
[Gregorys-iMac]:(gkd) ~/Programs/wine_track $ flutter packages upgrade resolved
Running "flutter packages upgrade" in .... 2.7s
In the package cache, I have both:
/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
flutter pub upgrade --major-versions
you can simply run flutter packages upgrade
in your project to upgrade all the packages. this feature is available from flutter version 1.17
Just use
flutter pub upgrade --major-versions
or
flutter packages upgrade
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With