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

3,889

Solution 1

You can specify the specific version you want to use in your pubspec.yaml. 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.

Solution 2

You can also use dependency_overrides to override dependency, with this you can use both the version of your dependency at once.

dependencies:
 package_name : latest_version

dependency_overrides:
 package_name : older_version
Share:
3,889
Ahmad Hassan
Author by

Ahmad Hassan

Google Developer Student Club Leader | Google Flutter UX Researcher | Data Scientist

Updated on December 21, 2022

Comments

  • Ahmad Hassan
    Ahmad Hassan over 1 year

    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