Recently (today) I tried to create an app for web and desktop with Flutter and wanted it to be in multiple languages (English, French, Arabic, Dutch…) so I looked at Flutter’s tutorial and followed every steps it had. And just after finishing the last step I had it working ! I could add text in, English in the app_en.arb file and in any other language in app_fr.arb by example. When I hot reloaded/restarted my app the Dart files it generates are rebuilt. But now when I do that I have an error that I couldn’t find anywhere else on Internet:
Exception: Found syntax errors.
And the dart files for localization weren’t rebuilt. Now I must use the
flutter gen-l10n
command to rebuild my language files.
Note:
Here’s my flutter doctor:
[✓] Flutter (Channel master, 3.7.0-10.0.pre.33, on Fedora Linux 37 (Workstation Edition) 6.0.12-300.fc37.x86_64, locale fr_FR.UTF-8)
• Flutter version 3.7.0-10.0.pre.33 on channel master at /home/theskyblockman/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cee3e6cc3d (il y a 8 heures), 2022-12-17 04:03:24 -0500
• Engine revision b107699980
• Dart version 3.0.0 (build 3.0.0-35.0.dev)
• DevTools version 2.20.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /home/theskyblockman/Android/Sdk/
• Platform android-33, build-tools 33.0.0
• Java binary at: /home/theskyblockman/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[✓] Android Studio (version 2021.3)
• Android Studio at /home/theskyblockman/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738
• Flutter plugin version 71.0.3
• Dart plugin version 213.7433
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Community Edition (version 2022.2)
• IntelliJ at /home/theskyblockman/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/222.4459.24
• Flutter plugin version 71.0.5
• Dart plugin version 222.4459.16
[✓] VS Code (version 1.74.0)
• VS Code at /usr/share/code
• Flutter extension version 3.54.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Fedora Linux 37 (Workstation Edition) 6.0.12-300.fc37.x86_64
• Chrome (web) • chrome • web-javascript • Google Chrome 110.0.5464.2 dev
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
2
Answers
it's me again, this looked like a PATH problem in my case. Now that I restarted my computer I don't have the error anymore, I should have checked that before. But as I never saw this error before you should check other things like dependencies versions or your Dart and Flutter SDKs, I am not sure about how it happened so restart your computer and check a lot of things could help fix the problem.
In my case this error had appeared after I renamed the folder where project files was. I fixed all paths with old folder name, but the error was still persist.
flutter clean
didn’t help.Then in folder named
.idea
I found few files (.xml
and.iml
extensions) that contained the old folder’s name. After I fixed it the error was gone. Hope will help.