Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error setting-up flutter_localizations package "Target of URI doesn't exist: 'package:flutter_gen/gen_l10n/app_localizations.dart'."

This error appears when I try to add language support to my flutter application:

Target of URI doesn't exist: 'package:flutter_gen/gen_l10n/app_localizations.dart'. Try creating the file referenced by the URI, or Try using a URI for a file that does exist.

I’m using flutter_localizations, the project is built with dart 2.7.0

It seems that flutter_localizations needs latest sdk which is dart 2.13.0

How can I fix this?

like image 600
Hind Avatar asked Jan 21 '26 01:01

Hind


1 Answers

I had this same issue with import 'package:flutter_gen/gen_l10n/app_localizations.dart' in Visual Studio Code after updating to Flutter 2.5.

After closing the VS Code window and reopening it, the error was gone. If that doesn't work, try closing and opening VS Code again.

Or restart the Dart Analysis Server by going to View > Command Palette and then typing Dart: Restart Analysis Server.

Credit goes to https://stackoverflow.com/a/68150402/4797855 and https://stackoverflow.com/a/68731436/4797855.

like image 125
Fritz Lim Avatar answered Jan 23 '26 20:01

Fritz Lim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!