Revising a previously published Dart package version - flutter

I have published many versions of a Dart package, but I want to go back an update a previous version. Let's say I have published these versions:
1.0.0 - first version
1.1.0 - minor update
2.0.0 - major update with breaking changes
I would like to go back and publish version 1.2.0 with a small change to 1.1.0 code, but not use the 2.0.0 code. If I use pub publish with version 1.2.0, will it add it to the versioning list correctly, or will it use publish date order instead?

I believe that it should work correctly, and if it doesn't, it would be a bug that should be reported.
As an example, the versions of the path_provider package show that version 1.6.28 was uploaded after 2.0.0 and 2.0.1, but 2.0.1 (as of writing) is advertised as the latest stable version.

Related

Sentry version incompatibility

Sentry latest version is incompatible with http plugin and if another version of sentry is used then it is also not compatible with rest of the other already used packages in project.
Even without version I tried to get its compatible version but this also not worked.
This is because Sentry uses http: ^0.13.0 because that's the earliest version which is null safe. The user uses a pretty outdated version of http.
Got the reply from GitHub: https://github.com/getsentry/sentry-dart/issues/694

Dart: What is the difference between the "Upgradable" and "Resolvable" columns in the output of "dart pub outdated"?

What is the difference between the "Upgradable" and "Resolvable" columns in the output of "dart pub outdated"?
Here is an example of a package that can be upgraded to the latest. The Upgradable, Resolvable, and Latest all match:
url_launcher *6.0.11 6.0.12 6.0.12 6.0.12
Here is an example of a package that is already at the highest resolvable version, but can't be upgraded to the absolute latest version. Presumably another dependency is restricting the resolvability to the latest.
rxdart *0.26.0 *0.26.0 *0.26.0 0.27.2
Here is an example of a package that can't be upgraded any higher but has a Resolvable version that is higher. What does this mean? How is this different from the middle case above?
provider *5.0.0 *5.0.0 6.0.1 6.0.1
In addition to the other very useful posted thoughts, I have learned the following helpful details:
Upgradable refers to the highest version that your direct pubspec will permit, which considers the sdk version and the individual package version (whether to upgrade to just minor or also major). When Upgradable is limited, it can likely be your sdk version holding things back. In my case I was using sdk 2.12, but some packages require 2.14 now (Sep 2021).
From the docs:
The latest version allowed by your pubspec.yaml file. This is the version that dart pub upgrade resolves to. The value is - if the value in the Current column is -.
Resolvable refers to the highest version that all of the other packages' dependencies will allow, in addition to your direct pubspec constraints. When the Resolvable is limited, there is usually one package holding everything back, or a major version holding everything back.
From the docs:
The latest version that can be resolved, when combined with all other dependencies. This version corresponds to what dart pub upgrade gives you if all version constraints in pubspec.yaml are unbounded. A value of - means that the package won’t be needed.
Upgradable means an upgradeable version. Generally, minor version updates can be upgraded directly without modification.
Resolvable can use the version, generally a major version update (the 0.x version may have destructive changes, same as major version), may have incompatible interfaces to the previous version, if you update this version, you may need to change some code
Latest The latest version. If it is inconsistent with the Resolvable version, means the SDK version required by the latest version is inconsistent with the current project
The main difference is that Resolvable mains the version you need to reach to resolve outdated issues in your project and Upgradable mains the version you can update of that package.
To resolve it you must find packages you can update and continue updating until you can update the main package.
You can see it in this link about those concepts: Dart pub outdated

Is the Flutter pod in Cocoapods the same as the Flutter SDK?

I'm currently working on a project that uses Cocoapods in Flutter 2.2.3 and I'm having Issues with the Flutter pod that in included when I run pod install. The version it is giving me is Flutter 1.0.0, even though I'm building the app using flutter 2.2.3.
This is the output I get from running pod outdated:
Updating spec repo `trunk`
Analyzing dependencies
The color indicates what happens when you run `pod update`
<green> - Will be updated to the newest version
<blue> - Will be updated, but not to the newest version because of specified version in Podfile
<red> - Will not be updated because of specified version in Podfile
The following pod updates are available:
- Firebase 8.3.0 -> (unused) (latest version 8.4.0)
- FirebaseCore 8.3.0 -> 8.3.0 (latest version 8.4.0)
- Flutter 1.0.0 -> 1.0.0 (latest version 2.0.2)
This begs the question, is the Flutter pod equivalent and/or overriding the Flutter SDK? I don't think it is but I haven't been able to find any concrete explanation of what the difference between the two are. I tried looking up the Flutter pod on the cocoapods website but the description did not prove helpful at all.
I was wondering the same and came across this issue: https://github.com/flutter/flutter/issues/53673
It looks like this is to be expected and doesn't really matter:
This is expected. The Flutter framework isn't downloaded from CocoaPods; it's copied from your installed Flutter SDK. So it's hard-coded to 1.0 since there's no version resolution for CocoaPods to handle. If you see actual issues related to this, pleas let us know!
Rather confusing given that CocoaPods shows you there's a newer version.

What version of plugin, Flutter get/fetch when I add dependency of prerelease version with carat symbol?

What version does flutter fetch when I add plugin dependency like below code:
dependencies:
pluginA: ^0.1.8
If available versions are 0.1.8+1, 0.1.9, 0.2.0 etc.
As I see version ^2.1.3 and '>=2.1.3 < 3.0.0' are equal, but except for the prerelease version.
(checked from this link)
So does flutter fetch the updated patch version of pluginA, or fetch the exact version in my case?
I found my answer, here flutter will fetch the latest patch version of pluginA, and in my case, it is 0.1.9.
It is similar to:
pluginA: '>=0.1.8 < 0.2.0'

How to get latest version of package in flutter create template

I am modifying my default template file from my flutter installation directory here
C:\src\flutter\flutter\packages\flutter_tools\templates\app\pubspec.yaml.tmpl
dependencies:
#omitted
cupertino_icons: ^0.1.3
mobx: latest
flutter_mobx: latest
I am getting this error
Invalid version constraint: Could not parse version "latest". Unknown text at "latest".
How do i get the latest version instead of specifying specific version like ^1.x.x
There is no latest, you have to specify the version number or you can use any:
any
The string any allows any version. This is equivalent to an empty version constraint, but is more explicit. Although any is allowed, we don’t recommend it.
https://dart.dev/tools/pub/dependencies
To update your dependencies to the latest version you can do the following:
Use pub upgrade to update to the latest package versions that your pubspec allows. To identify dependencies in your app or package that aren’t on the latest stable versions, use pub outdated.
try this after the package that you want the latest
http: ^{latest version}