Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve 'flutter downgrade' error message #154434

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

loic-sharma
Copy link
Member

@loic-sharma loic-sharma commented Aug 30, 2024

flutter downgrade fails if you haven't used flutter upgrade:

$ flutter downgrade
There is no previously recorded version for channel "stable".

It's not clear what actions a user should take from this error message. Here's the new error message:

$ flutter downgrade
It looks like you haven't run "flutter upgrade" on channel "stable".

"flutter downgrade" undoes the last "flutter upgrade".

To switch to a specific Flutter version, see: https://flutter.dev/to/switch-flutter-version

Depends on flutter/website#11098

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 30, 2024
Comment on lines +211 to +213
if (buffer.isEmpty) {
buffer.writeln();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this extra writeln call necessary? Is the condition meant to be negated here (I don't know this code).

Copy link
Member Author

@loic-sharma loic-sharma Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds an extra line between the help text and the list of channel last versions:

To switch to a specific Flutter version, see: https://flutter.dev/to/switch-flutter-version

Channel "master" was previously on: v1.2.3.
Channel "beta" was previously on: v1.0.0.

Without this, the output would be:

To switch to a specific Flutter version, see: https://flutter.dev/to/switch-flutter-version
Channel "master" was previously on: v1.2.3.
Channel "beta" was previously on: v1.0.0.

Is the condition meant to be negated here (I don't know this code).

This condition is intentional. We only want to add this extra new line on the first channel we output, and only if we output at least one channel.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah. understood—thanks!

Copy link
Contributor

@andrewkolos andrewkolos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM—thanks 😃

sfshaza2 pushed a commit to flutter/website that referenced this pull request Aug 30, 2024
Explains how to switch to a specific Flutter version.

This will be used by the Flutter tool's error message when a user
attempts to `flutter downgrade` but has never used the `flutter upgrade`
command: flutter/flutter#154434

## Presubmit checklist

- [x] This PR is marked as draft with an explanation if not meant to
land until a future stable release.
- [x] This PR doesn’t contain automatically generated corrections
(Grammarly or similar).
- [x] This PR follows the [Google Developer Documentation Style
Guidelines](https://developers.google.com/style) — for example, it
doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person).
- [x] This PR uses [semantic line
breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)
of 80 characters or fewer.
@loic-sharma loic-sharma added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 31, 2024
@piedcipher
Copy link
Member

autosubmit didn't merge?! CI is green 👀

@loic-sharma loic-sharma added autosubmit Merge PR when tree becomes green via auto submit App and removed autosubmit Merge PR when tree becomes green via auto submit App labels Sep 4, 2024
@loic-sharma
Copy link
Member Author

Let's try the good ol' turn it off and on again!

@auto-submit auto-submit bot merged commit 3bda455 into flutter:master Sep 4, 2024
130 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants