Skip to content

[Feature request] pub upgrade prompts #2038

@amirh

Description

@amirh

For package updates that include breaking changes it can be sometimes useful to present the developer(package user) with a prompt showing a message provided by the package developer.

I think this would be useful when the change in the package requires more than just adjusting the code to a new API.

While the CHANGELOG is the official place to include such instructions the recent experience with upgrading flutter plugins to use AndroidX showed that many people don't always read these(e.g flutter/flutter#27226 flutter/flutter#27146 flutter/flutter#27156)

What I envision is that we could include some breaking change message with the upgrade(in pubspec.yaml?) which will result in something like the following when running pub upgrade:

$ flutter pub upgrade
....
Upgrading battery to 0.3.0 requires migrating your app to use AndroidX, please follow the 
upgrade instructions here: <link>.
 
Do you still want to upgrade to battery to 0.3.0? [y/N]
(selecting no will pin battery to ^0.2.0)

The 2 use cases I think this might help with are:

  1. A user has battery: ^0.2.0 in his pubspec, he sees there's a new major upgrade to the battery package, he goes to pubspec.yaml and changes to battery: ^0.3.0 planning on spending some time figuring out the new API changes. But instead he gets some obscure Gradle error he doesn't know how to deal with.
  2. A user has battery: any. (yeah this is not recommended, but this happens in practice)

I believe this would be mostly useful for Flutter plugins where it is common to require some manual environment setup steps from the package users(e.g set up API keys, config Gradle, config Info.plist, etc...)

cc @kevmoo @mklim

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions