Search code examples
flutterdart-pub

flutter pub publish: Could not find an option named "dry-run"


When publishing a pub package, the docs say to run the following command:

 flutter pub publish --dry-run

However, this is giving the following error:

Could not find an option named "dry-run".

Run 'flutter -h' (or 'flutter -h') for available flutter commands and options.

How do I run a "dry-run"?

This is a self-answer Q&A after finding the answer. The answer is below.


Solution

  • Update:

    This command works now:

    flutter pub publish --dry-run
    

    Original answer

    Use:

    flutter pub pub publish --dry-run
    

    Thanks to this post for the solution.