Closed holyspidoo closed 6 years ago
What version of the package are you using? Since Flutter uses Dart 2.0, you'll need to use version 2.0.0 of pub_client if you're not already doing so.
I'm using Dart VM version: 2.0.0 and pub_client: ^2.0.0
I'm at work at the moment, but I can dig into it when I get home tonight. You're also welcome to submit a PR if you want. I suspect it's primarily a type inference issue.
I've figured out the problem and it has to do with the format of the dependencies and dev_dependencies data.
This library currently only supports dependency and dev_dependency JSON properties that don't have any nesting. For example:
{
...
"dependencies": {
"http": "^0.11.3+17",
"json_annotation": "^1.0.0"
},
...
}
However, dependencies can also be specified like so:
{
...
"dependencies": {
"flutter": {
"sdk": "flutter"
}
},
...
}
This library doesn't currently support this 2nd format (and several others). I'm trying out a few ideas for how to resolve this, so hang tight.
Great news! Thanks for looking into this, pub_client is really useful!
I just published version 3.0.0 which has some backwards incompatible changes around how dependencies are handled. Instead of having the dependenices
and devDependencies
properties be simple Map
s, they're now objects with multiple maps under them: simpleDependencies
, complexDependencies
, sdkDependencies
, and gitDependencies
. Unfortunately this was the only way I could handle the various dependency structures while still maintaining strong typing.
Take a look at this test for an example of the new structure.
I hope this helps!
Great! It works!! A million thanks!
When I call
var onlinePackage = await client.getPackage(packagename);
I get on most packages:
type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String' in type cast
Example package that does it: dragable_flutter_list
Example package that works fine: cupertino_icons