skip to Main Content

The current Dart SDK version is 3.16.8. When i goin to add firebase_core package getting following issue.

The lower bound of "sdk: ‘>=1.8.0 <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

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

My pubspec.yaml as follows

name: ecommerce_application_2024
description: "A new Flutter project."

version: 1.0.0+1

environment:
  sdk: '>=3.2.5 <4.0.0'

dependencies:
  flutter:
    sdk: flutter

# Utility packages
  http: ^1.1.0
  intl: ^0.19.0
  logger: ^2.0.2+1
  url_launcher: ^6.2.4
  flutter_native_splash: ^2.3.11
  smooth_page_indicator: ^1.1.0
  
  iconsax: ^0.0.8
  cupertino_icons: ^1.0.2

  get: ^4.6.5
  get_storage: ^2.1.1

  # Product Specific
  readmore: ^2.2.0
  carousel_slider: ^4.2.1
  flutter_rating_bar: ^4.0.1

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0


flutter:

  uses-material-design: true

  assets:
    - assets/logos/
    - assets/icons/brands/
    - assets/images/content/
    - assets/images/banners/
    - assets/images/reviews/
    - assets/images/products/
    - assets/icons/categories/
    - assets/images/animations/
    - assets/icons/payment_methods/
    - assets/images/on_boarding_images/

  fonts:
    - family: Poppins
      fonts:
        - asset: assets/fonts/Poppins-Light.ttf
          weight: 300
        - asset: assets/fonts/Poppins-Regular.ttf
          weight: 400
        - asset: assets/fonts/Poppins-Italic.ttf
          style: italic
        - asset: assets/fonts/Poppins-Regular.ttf
          weight: 400  
        - asset: assets/fonts/Poppins-Medium.ttf
          weight: 500
        - asset: assets/fonts/Poppins-MediumItalic.ttf
          weight: 500
        - asset: assets/fonts/Poppins-SemiBold.ttf
          weight: 600
        - asset: assets/fonts/Poppins-Bold.ttf
          weight: 800

I try to change flutter environment

from

environment:
  sdk: '>=3.2.5 <4.0.0'

to

environment:
  sdk: '>=2.12.0 <4.0.0'

but i can’t get build

2

Answers


  1. You can try these steps ->
    Keep the SDK – sdk: '>=3.2.5 <4.0.0'

    1. flutter clean
    2. flutter packages upgrade

    Also remember to add the output of flutter doctor in your post

    Login or Signup to reply.
  2. I’m also having same sdk version I just added flutter pub add firebase_core from command prompt and it’s working fine

    ‘>=3.2.5 <4.0.0’ in this range null safety would be automatically enabled .

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