Search code examples
flutterdartdependenciesflutter-dependenciesdart-pub

How to force flutter to use a old version of dependency?


After migration on flutter 1.17 application wont build. Circular check box is causing a error because with the migration on flutter 1.17 it is upgraded to 1.0.2 and even though i am using 1.0.1 in my app flutter still takes it as 1.0.2 and its causing trouble. Link to github issues This clears what my problem is and what's the solution but i don't know how to force or degrade a version. Changing the version in yaml isn't working. I've also tried using dependency_overrides: 1.0.1 but still error. enter image description here


Solution

  • You can specify the specific version you want to use in your pubspec.yaml by not including a caret ^ before the version number as we usually do. See this for more information of selecting package versions.

    An example for your use:

    dependencies:
      package_name: '1.0.1'
    

    You should then run flutter pub upgrade to ensure that the package that will be used updates, though this may be unecessary.