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

Issue

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

Use:

flutter pub pub publish --dry-run

Thanks to this post for the solution.

Answered By – Suragch

Answer Checked By – Timothy Miller (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.