skip to Main Content

Today, I got a job after struggling so much, Now they asked me to clone a project from master file and run the project, from past two days i ma trying hard to run the project but i am getting errors like in whole project i am getting error on snackbarshow, flatbutton, raisedbutton, and zoomopion, they are on red lines, and also i am getting error on dependencies like Resolving dependencies…
The lower bound of "sdk: ‘>=2.11.0 <3.0.0’" must be 2.12.0’
or higher to enable null safety.
enter image description here

The current Dart SDK (3.0.3) only supports null safety.

i have tried almos every solution on google like changing sdk version in pubspecyml file and also upgrade my flutter too, here is my flutter info: i am using andriod studio, Flutter is already up to date on channel stable
Flutter 3.10.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 682aa387cf (2 days ago) • 2023-06-05 18:04:56 -0500
Engine • revision 2a3401c9bb
Tools • Dart 3.0.3 • DevTools 2.23.1

2

Answers


  1. It seems this project was made with a very old version of flutter. Before null-safety. If I’m not mistaken they introduced that in version 2.0.0 of flutter and the version before that is 1.22.6. If you don’t want to migrate your project to make the project compatible with the latest flutter you can try to run it with flutter 1.22.6. Unfortunately it’s not very straightforward how to do that. What you can try to do is open a command prompt and go the folder where your flutter sdk is located and write

    git checkout 1.22.6
    

    After that try a

    flutter doctor
    

    in your project, and see if it changed it to the right flutter version.

    This is not guaranteed to work, but it’s worth a try, although I think there’s only a small chance that this works. If it doesn’t work I’m afraid you will need to refactor the project to make it work with the latest flutter version. If you want to revert the change that git checkout 1.22.6 did simply do

    flutter channel stable
    

    and

    flutter upgrade
    

    from your project.

    Login or Signup to reply.
  2. Its Better to change the flutter_zoom_sdk as its out of date and causing errors.
    try using=> zoom: ^1.0.4 or add the general zoom SDK for each platform using method channel. Its also recommended to update all the packages to Dart 3 compatible versions for avoiding future issues. Also Use dart fix –dry-run to see suggested changes and dart fix –apply to apply them.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search