Dropsource / monarch

Monarch is a tool for building Flutter widgets in isolation. It makes it easy to build, test and debug complex UIs.
https://monarchapp.io
MIT License
433 stars 22 forks source link

Monarch 3.3.0 doesn't work on Flutter stable #85

Closed divan closed 1 year ago

divan commented 1 year ago

I just decided to check which is the latest version of monarch and after checking pub.dev, updated pubspec.yaml to use monrach 3.3.0. Upon flutter pub get got following error:

... depends on monarch >=3.3.0 which requires Flutter SDK version >=3.8.0-0.0.pre, version solving failed.

After googling and searching for issues in this repo, found https://github.com/Dropsource/monarch/issues/80 which basically explains that this is intentional.

I believe this is confusing because people (who, I believe, mostly use stable) would first discover pub.dev and not that closed Github issue, and will go through the same process of getting an error, being confused, spending time googling and only then realizing that they should use "old" version. Maybe it's better using branches for versions that aren't stable yet?

fertrig commented 1 year ago

It is confusing, like you said.

I wish pub.dev would tell you which flutter sdk version a package version is compatible with. It only tells you which dart sdk version it is compatible with, not the flutter sdk version: https://pub.dev/packages/monarch/versions

Also, it doesn't help that flutter doesn't follow semver rules.

I documented the compatibility issues in the changelog which you can see in pub.dev: https://pub.dev/packages/monarch/changelog

However, it is not an ideal experience. It is still error prone.

Maybe it's better using branches for versions that aren't stable yet?

I'm not sure what you mean. pub.dev doesn't have the concept of branches. A package could have pre release versions in pub.dev. However, those aren't automatically resolved by flutter pub get so it would hurt users that want latest.

You can set monarch: ^3.0.0 in your pubspec.yaml. flutter pub get will then resolve to either monarch 3.0.1 or 3.3.0 based on which flutter version your project is running.

divan commented 1 year ago

I'm not sure what you mean. pub.dev doesn't have the concept of branches.

I mean keep pub.dev for the latest stable release of Monarch, and git branches for those who want to be on the edge. People can specify git branch in pubspec.yaml. Basically they would have to put in their pubspec.yaml something like this:

dev_dependencies:
    monarch:
      git:
        url: https://github.com/Dropsource/monarch.git
        ref: latest-branch

or just use latest git main branch (unpublshed to pub.dev):

dev_dependencies:
    monarch:
      git:
        url: https://github.com/Dropsource/monarch.git
fertrig commented 1 year ago

That would work. I think publishing a pre-release would have been a good option. However, I decided against it because most people use monarch init to set up monarch, which updates pubspec.yaml with monarch: ^3.0.0 which works fine for all flutter versions. We do have several flutter beta users.

In hindsight, I should have gone with the pre-release to avoid the issue you experienced. I think Flutter 3.8 will come out soon so I think it makes sense to leave things as they are for now.