Dart - error running rpc generate client

138 views Asked by At

I am trying to follow the "Beware the Nest o’ Pirates" tutorial https://www.dartlang.org/codelabs/server/ and have hit a problem when I try to generate the client code for the PiratesApi

When I run the command

pub global run rpc:generate client -i lib/server/piratesapi.dart -o lib/client

I get the following error message

Failed executing command 'discoveryWithImports' with error:

No constructor 'ApiParser' with matching arguments declared in class 'ApiParser'.

NoSuchMethodError: incorrect number of arguments passed to method named 'ApiParser'

Receiver: Type: class 'ApiParser'

Tried calling: ApiParser(strict: true)

Found: ApiParser()

What does that error message mean?

1

There are 1 answers

0
Göran On

Try activating the rpc package with a version constraint:

pub global activate rpc 0.4.1

https://www.dartlang.org/tools/pub/cmd/pub-global.html