Flutter: Undefined name 'AppLocalizations'. Try correcting the name to one that is defined, or defining the name
Asked Answered
V

4

6

Flutter Default Localizations isn't work when I use GetX Statemanagement. It show me a error like

Undefined name 'AppLocalizations'.
Try correcting the name to one that is defined, or defining the name.

enter image description here

How Can I fixed this ?

Vacuum answered 1/3, 2022 at 8:47 Comment(0)
E
3

Please add these dependencies on pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  intl: ^0.17.0

More information here

Euphemie answered 2/3, 2022 at 11:35 Comment(0)
H
2

for me the problem solved by

This creates a pubspec.yml file with the following entries:

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  intl: any

then pub get

Handicapper answered 22/6, 2023 at 14:3 Comment(0)
L
1

Add it in dependency -> generate:true;

Lodge answered 10/10, 2023 at 5:27 Comment(0)
C
0

I had this problem in a Flutter widget test code. The solution illustrated by the images below is applicable to the Flutter app code as well. Note that my Flutter app is conform to the MVVM architecture using Provider, the reason why MultiProvider is used. The code of the project is available on GitHub My AudioLearn prototype project. Note that the real project will be referenced in the readme file and will available as well since earning money is not what motivates me to develop this application.

Solution in widget test code 1

Solution in widget test code 2

Solution in widget test code 3

Solution in widget test code 4

Carbolize answered 9/4, 2023 at 16:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.