[Solved] Requires SDK version >=2.18.6 <3.0.0

Encountering errors while working on a Flutter project can be frustrating. One common issue is the “Requires SDK version >=2.18.6 <3.0.0” error, which indicates a version compatibility problem with the SDK.

In this guide, we will walk through the steps to fix this error without modifying your project’s source files or updating Dart and Flutter versions.

Because it requires SDK version >=2.18.6 <3.0.0, version solving failed.

pub get failed (1; Because requires SDK version >=2.18.6 <3.0.0, version solving failed.)

Steps to Fix Requires SDK version >=2.18.6 <3.0.0

If you found this type of issue in your project, there is no need to change anything in the project source files or update the Dart and Flutter versions; simply follow these steps:

Fix Requires SDK version
  1. Launch your pubspec.yaml file.
  2. SDK version search
  3. Replace your current SDK version with the required SDK version.

Try like this:

Check Out: [Solved] Unable to load asset: images in Flutter

Step 1: Open pubspec.yaml

Locate and open the pubspec.yaml file in your Flutter project. This file contains the project’s dependencies and configuration.

Step 2: Search for SDK Version

Within the pubspec.yaml file, search for the line that specifies the SDK version for your project. It usually looks like this:

From:

environment:
sdk: '>=2.18.0 <3.0.0'

Step 3: Update the SDK Version

Replace the existing SDK version range with the required SDK version mentioned in the error message. In this case, it should be ‘>=2.18.6 <3.0.0’. Modify the line as follows:

To:

environment:
sdk: '>=2.18.6 <3.0.0'

Step 4: Save Changes

Save the changes made to the pubspec.yaml file.

Step 5: Get Dependencies

To ensure the changes take effect, you need to fetch the updated dependencies. There are two ways to do this:

 environment:
 sdk: '>=2.18.0 <3.0.0'

Conclusion

By following these steps, you can resolve the “Requires SDK version >=2.18.6 <3.0.0” error in your Flutter project without making any changes to your source files or updating Dart and Flutter versions.

Remember to always check for specific version requirements and update the SDK version accordingly in your pubspec.yaml file. After updating, run flutter pub get to fetch the updated dependencies.

Share:
Ambika Dulal

Ambika Dulal is a Flutter Developer from Nepal who is passionate about building beautiful and user-friendly apps. She is always looking for new challenges and is eager to learn new things. She is also a strong believer in giving back to the community and is always willing to help others.

Leave a Comment

AO Logo

App Override is a leading mobile app development company based in Kathmandu, Nepal. Specializing in both Android and iOS app development, the company has established a strong reputation for delivering high-quality and innovative mobile solutions to clients across a range of industries.

Services

UI/UX Design

Custom App Development

Mobile Strategy Consulting

App Testing and Quality Assurance

App Maintenance and Support

App Marketing and Promotion

Contact

App Override

New Plaza, Kathmandu