The lower bound of "sdk: '>=2.1.0 <3.0.0'" must be 2.12.0 or higher to enable null safety
Asked Answered
H

5

6

Hi how this problem solvedenter image description here

I added the widget "dropdown_formfield: ^0.1.4" to my project and it showed this error How can I fix this problem please help. This package : https://pub.dev/packages/dropdown_formfield

Holocaine answered 17/3, 2023 at 10:45 Comment(0)
S
5

You must update your flutter/dart version like this (in your pubspec.yaml):

environment:
  sdk: ">=2.18.0"

Be prepared to make changes on your project/code due null safety

Or seek to find a lower version of that "dropdown_formfield" that can be supported by your actual flutter/dart version.

Stefaniastefanie answered 17/3, 2023 at 10:59 Comment(0)
N
2

Try upgrading your constraint on cupertino_icons: flutter pub add cupertino_icons:^1.0.6

Neotype answered 9/1 at 15:49 Comment(0)
M
0

write

any keyword

instead of ^0.1.4

Mascara answered 17/3, 2023 at 11:5 Comment(2)
any is not the case as it download the current latest stable version of plugin. So. at this point requires dart version > 2.1Stefaniastefanie
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Dilworth
V
0

I tried to add this package https://pub.dev/packages/slimy_card but I faced this

Because ptc_flutter depends on slimy_card any which doesn't support null safety, version solving failed.

The lower bound of "sdk: '>=2.1.0 <3.0.0'" must be 2.12.0 or higher to enable null safety. For details, see https://dart.dev/null-safety

Vshaped answered 26/7, 2023 at 6:7 Comment(0)
F
0

Faced the same problem running a test code as part of udemy course from GitHub repo mi_card_flutter

As you can see, my flutter version is 3.16.9

flutter --version
Flutter 3.16.9 • channel stable • https://github.com/flutter/flutter.git

And my dart version is 3.2.6

  dart --version
Dart SDK version: 3.2.6 (stable) (Wed Jan 24 13:41:58 2024 +0000) on "macos_x64"

What I noticed is this code was updated 3 years ago and my Flutter and Dart versions were new. So I have made couple of updates.

Update below in the pubspec.yaml

environment:
  sdk: '>=3.2.6 <4.0.0'

After this, when I pulled dependencies using Get Depenencies on main.dart in Android Studio, saw below errors

    The current Dart SDK version is 3.2.6.
    
    Because mi_card depends on cupertino_icons >=0.1.1 <1.0.1 which doesn't support null safety, version solving failed.
    
    The lower bound of "sdk: '<2.0.0 or >=2.0.0-dev.28.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.
    For details, see https://dart.dev/null-safety

You can try the following suggestion to make the pubspec resolve:
* Try upgrading your constraint on cupertino_icons: flutter pub add cupertino_icons:^1.0.6

As you can see in the error its suggesting to use the 1.0.6 version.

So change which I had to do this to upgrade the version of cupertino_icons dependency from 0.1.2 to below

cupertino_icons: ^1.0.6

And it worked perfectly fine.

Factitious answered 12/2 at 16:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.