Home > Net >  Could not find package flutter_localization in the Flutter SDK
Could not find package flutter_localization in the Flutter SDK

Time:11-16

I am currently trying to implement localization in my Flutter App but whenever I try to add the dependency for flutter_localization, I get the following error Message:

Because the timer depends on flutter_localization from SDK which doesn't exist (could not find package flutter_localization in the Flutter SDK), version solving failed.

I have also correctly added the path to both my flutter and dart SDKs in Android Studio.

Here is my pubspec.yaml file:

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0 1

environment:
  sdk: '>=2.18.2 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  intl: ^0.17.0-nullsafety.2
  cupertino_icons: ^1.0.2
  sqflite: any
  shared_preferences: ^2.0.15
  path_provider: any
  flutter_localization:
    sdk: flutter
  flutter_cupertino_localizations: ^1.0.1

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

flutter:

  uses-material-design: true

I can't access GlobalMaterialLocalizations without flutter_localization and apparently, this is the easiest solution. I have already tried many solutions like checking version compatibilities and updating all dependencies. can you guys help me out?

Thanks in Advance!

Upgrading SDKs, Upgrading Dependencies, reinstalling flutter and Dart, and more

CodePudding user response:

flutter:
  generate: true

add this to your pubspec.yaml and follow the instructions in this article the using gen-l10n part

https://localizely.com/blog/flutter-localization-step-by-step/?tab=using-gen-l10n

CodePudding user response:

You misspelled the package

Replace

 flutter_localization:
    sdk: flutter

With

 flutter_localizations:
    sdk: flutter

Take note on the s on flutter_localizations

  • Related