Updating libraries that aren't yet updated on pub - dart

I want to use an updated library (Vadim Tsushko's mongo_dart at https://github.com/vadimtsushko/mongo_dart) but Pub (pub.dartlang.org) still has the older one, so a pub update doesn't help. I replaced mongo_dart in my packages directory. How can I update the package for all apps where it's referenced?
Thank you!

You may temporarily change pubspec.yaml to redirect dependency from pub.dartlang.org to concrete GitHub repository. For mongo_dart it is:
mongo_dart:
git: git://github.com/vadimtsushko/mongo_dart.git

Related

Flutter What is plugin_platform_interface and how to remove it from app?

So I have an app that cannot be archived in xcode because of plugin_platform interface does not support null safety. The thing is I don't use that and that package cannot be found inside pubspec.yaml. I searched for it inside my files and it appears to be inside image_picker library pubsec.yaml. And when I saw the version, it is version 2.0.0 which should support null safety. So what is the problem now? Can anyone help me?
Try to clean your cache and update dependencies
flutter clean
flutter pub get

Could not find pubspec.yaml in unittest 0.11.0+5

I'm running pub get and its reporting that it can't find a pubspec.yaml file in unittest package, anyone seen this before? Im on Dart Editor version 1.8.0.dev_00_00 (DEV) Dart SDK version 1.8.0-dev.0.0
The downloaded package in
C:\Users\daniel\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\unittest-0.11.0+5
didn't have a pubspec.yaml file in it, and using pub cache repair wouldn't work for that very reason also so I had to manually open the directory and delete it then when I did a new pub get it did work. Sounds like cache repair might need tweaking to make it delete any corrupted packages that didnt have their pubspecs downloaded with them and I beleive this broken state was created by me running a pub get whislt a pub get was already in progress on the same pubspec.yaml file, so probably best you avoid doing that.

Dart: pub get vs pub upgrade

According to the pub get docs the main difference between pub get and pub upgrade is:
If a lockfile already exists, pub get uses the versions of dependencies locked in it if possible. If a dependency isn’t locked, pub will get the latest version of that dependency that satisfies all the version constraints. This is the primary difference between pub get and pub upgrade, which always tries to get the latest versions of all dependencies.
But this leaves me with a few questions.
What do they mean by "If a dependency isn't locked...? Locked?!? Like in version control? File system lock? What is this lock of which they speak?
Still not clearly understanding the difference between these two commands. Are they saying that pub get takes version constraints into account, and that pub upgrade doesn't?
It is locked when the pubspec.lock file contains an entry for this dependency.
You can change the dependency in pubspec.lock manually to specify exactly what version you want to use.
pub upgrade checks for the newest version that fits your pubspec.yaml configuration and updates your pubspec.lock file automatically.
when pubspec.lock is checked in with your package code in a CVS repository you are able to later reproduce the exact same setup as you had when you checked in your code even when your pubspec.yaml allowed a wider range of versions for a dependency.
see also
Upgrading a dependency
In Dart and Pub, should I add pubspec.lock to my .gitignore?

Dart pub is not downloading dependencies

I had moved my Dart Project to another folder, with the same folder structure, however, now, I'm receiving the following message:
Running pub install ...
Pub install failed, [1] Resolving dependencies...
Could not find package "dartflash 0.6.3" at http://pub.dartlang.org.
Here is my pubspec.yaml:
name: Chronium
description: A framework for doing Chrono like games.
dependencies:
dartflash: 0.6.3
And pubspec.lock:
{"packages":{"dartflash":{"version":"0.6.3","source":"hosted","description":"dartflash"}}}
And the file structure:
The website (http://pub.dartlang.org/) is accessible from the browser.
I'm on dart (Dart Editor version 0.2.9_r16323). Do someone knows what is happening?
According to Seth Ladd post, this should be fixed now :
If you were having troubles with pub.dartlang.org, we're happy to report that we've fixed the issue. Many apologies for the temporary downtime. Looks like it was an issue with the server pointing to the wrong data store. Thanks for all the reports, the pub is open again!

pub install does not work in Dart

I am trying to install glmatrix using pub install. My OS is Windows 7 and I have Git installed.
Here is my pubspec.yaml
name: WebGLTut1
description: A sample application
dependencies:
glmatrix:
git: git://github.com/pjako/glmatrix.dart.git
When I run pub install I get the following error:
Running pub install ... Pub install fail, FormatException: Could not
parse "git://github.com/pjako/glmatrix.dart.git".".
I googled a while to find a solution but couldn't. Please help.
UPDATE#1:
I found the problem. There has to be a TAB/Space when specifying git: url in pubsec.yaml as follows.
glmatrix:
git: git://github.com/pjako/glmatrix.dart.git
This solved the previouse problem of FormatException. But now when I run pub install again it throws theis error.
Running pub install ... Pub install fail, Git failed.
As you identified you update, yaml files are whitespace sensitive; that's why you don't have to use lots of curly braces like json. :)
I see a few of possible problems here:
First
Glmatrix doesn't appear to have its own pubspec defined. Libraries participating in the package system much declare a pubspec file with the name property defined. The name is important because pub uses it when you declare your dependencies. Let's say you had a project called toast with the following simple pubspec:
name: butter
version: 0.0.0
Then you would need to declare your dependency to that project like so:
dependencies:
butter:
git: git://github.com/foo/toast.git
Have the project owner make the changes or fork it yourself, add the pubspec, and then reference your fork in your pubspec.
Second
Glmatrix is does not conform to the pubspec package layout conventions (your own projects should also conform to this). Although I believe that pub may handle non-conforming layouts currently, it may not in the future. So again, you can either ask the project owner to fix, or fork and fix it yourself.
Third
Since you are on windows, make sure git is in your system PATH variable. If you are using the bash shell, git will work, but it's not going to work outside of bash (like from Dart editor) until you add it to your PATH.

Resources