The current Dart SDK version does not satisfy null-safety dependences

886

I found the problem in the Visual Studio Code settings.json, where the dart.flutterSdkPath is setting incorrect to another folder.

Changing the flutter channel stable and flutter upgrade could resolve the problem with null-safety already.

Share:
886
apieceofcode1801
Author by

apieceofcode1801

Updated on December 29, 2022

Comments

  • apieceofcode1801
    apieceofcode1801 over 1 year

    I'm upgrading my project into sound null-safety. After changing the version to

    environment:
      sdk: ">=2.12.0 <3.0.0"
    

    then done converting my source code into null-safety syntax. When I ran my project, it ran flutter pub get, and the problem happened

    [flutter_shopify] flutter pub get
    Running "flutter pub get" in flutter_shopify...                 
    The current Dart SDK version is 2.12.0-133.2.beta.
    
    
    
    Because flutter_shopify requires SDK version >=2.12.0 <3.0.0, version solving failed.
    pub get failed (1; Because flutter_shopify requires SDK version >=2.12.0 <3.0.0, version solving failed.)
    exit code 1
    

    I changed the version to

    environment:
      sdk: ">=2.12.0-133.2.beta <3.0.0"
    

    but this time, it said:

    [flutter_shopify] flutter pub get
    Running "flutter pub get" in flutter_shopify...                 
    The current Dart SDK version is 2.12.0-133.2.beta.
    
    
    
    Because graphql 5.0.0-nullsafety.4 requires SDK version >=2.12.0 <3.0.0 and no versions of graphql match >5.0.0-nullsafety.4 <6.0.0, graphql ^5.0.0-nullsafety.4 is forbidden.
    
    So, because flutter_shopify depends on graphql ^5.0.0-nullsafety.4, version solving failed.
    pub get failed (1; So, because flutter_shopify depends on graphql ^5.0.0-nullsafety.4, version solving failed.)
    exit code 1
    

    I'm too confused about it, I know that the version of Dart SDK following the flutter SDK, but it's now not satisfying to the dependences.

    In this case, is there any way to upgrade my Dart SDK to higher than the version of flutter SDK holding?

    This is flutter doctor

    [✓] Flutter (Channel beta, 2.2.0-10.2.pre, on macOS 11.3 20E232 darwin-x64, locale en-VN)
        • Flutter version 2.2.0-10.2.pre at /.../flutter
        • Framework revision b5017bf8de (8 days ago), 2021-04-28 17:09:53 -0700
        • Engine revision 91ed51e05c
        • Dart version 2.13.0 (build 2.13.0-211.13.beta)
    

    Please help! Thank you guys a lot!