How To Upgrade Packages In Visual Studio Code Flutter?

How To Upgrade Packages In Visual Studio Code?

If you are developing a project in Flutter and do not know how to upgrade packages in Visual Studio Code/Flutter, you can get help from the Flutter Agency because it provides enough code to meet your needs and fix the problems. In the following section, you will know the right way to upgrade packages in flutter easily and quickly.

Regardless of the Flutter release channels you follow, it is mandatory to use the flutter command to upgrade your flutter SDK or packages that your app is based on. Scroll down the page to know how to upgrade flutter SDK and packages.

What are the packages?

The Dart package is the directory comprising the pubspec file. In addition, the package contains the dependencies that are listed in the pubspec file, apps, images, tests, resources, and Dart libraries. The pub.dev site lists several packages developed by the Flutter and Dart community members. You are witnessing those packages in your app.

Existing flutter packages enable several use cases such as HTTP to make network requests. You should go through developing packages to write the new package. All packages have the version number that is specified in the packages’ pubspec.yaml file.

Things to do to upgrade packages

Are you accessing Visual Studio code on the flutter project? Have you modified your pubspec.yaml file? Or do you wish to update only the packages your app depends on? Well, you should use one of the flutter pub commands.

You have to use the upgrade command if you want to update the latest compatible versions of all the dependencies mentioned in the pubspec.yaml file.

Here is the upgrade command: $ flutter pub upgrade

Upgrade Packages in VSCode

Accessing the outdated command “$ flutter pub outdated” is important to find outdated packaged dependencies and obtain advice on how to update them easily.

Upgrade Packages in VSCode Flutter

These two commands help you to update the packages in your VSCode/Flutter.

You can even navigate to https://pub.dartlang.org/packages and locate the latest packages. If you find the latest package, you can tab the install tab. You can now add the dependencies into your pubspec.yaml file in your flutter package.

You can run flutter packages in your flutter project to upgrade all the packages. This amazing feature is available from flutter version 1.17.

How can you point to the new package?

When you edit the pubspec.yaml file to point to a later version of the package, it will run “flutter packages get” automatically in ‘/development/flutter/pub-cache/hosted/pub.dartlang.org’ directory. It lets you witness both versions of packages. However, in some cases, when you compile, it looks like you are still assessing the older version of the packages.

In such circumstances, you can try out ‘flutter packaged upgrade‘ and ‘flutter clean’. It renders the best solution in many circumstances. If you do not get the expected solution even after accessing these things, you will use the following code.

While looking at the two package versions’ source code, you find the problem in the newer version. Well! The following code will help you to sort it out easily. If you have any doubt about this code or need some clarification, then you can reach Flutter Agency without hesitation.

It is the right platform to access the cool resources and obtain adequate knowledge about the flutter. It assists you in doing whatever you want in the flutter project and obtains the desired result easily.

How to update the package The ethereum package is not updating in this scenario. Even though the 3.0.0 version is used and switched to the 3.10 version, compiling with the 3.1.0 version call balks with incorrect argument count like this:

client.admin.personalSendTransaction (BigInt.parse(currentAddress), currentPassword,{});
[dart] Too many positional arguments: 2 expected, but 3 found. [extra_positional_arguments_could_be_named]

But, hovering over the method call does display 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
Pubspec.yaml file
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"
If you want to use version 3.1.0, then running "flutter packages upgrade resolved" provides:
[Gregorys-iMac]:(gkd) ~/Programs/wine_track $ flutter packages upgrade resolved
Running "flutter packages upgrade" in .... 2.7s

Conclusion

After reading the scenario mentioned above, you will understand the right way to upgrade packages in VSCode/flutter. Try to follow the instructions and commands properly to upgrade the packages easily. As said earlier, do not hesitate to ask for assistance from the Flutter Agency.

Abhishek Dhanani

Written by Abhishek Dhanani

Abhishek Dhanani, a skilled software developer with 3+ years of experience, masters Dart, JavaScript, TypeScript, and frameworks like Flutter and NodeJS. Proficient in MySQL, Firebase, and cloud platforms AWS and GCP, he delivers innovative digital solutions.

Leave a comment

Your email address will not be published. Required fields are marked *


ready to get started?

Fill out the form below and we will be in touch soon!

"*" indicates required fields

✓ Valid number ✕ Invalid number
our share of the limelight

as seen on