Fixing Android Studio's Slowness While Developing with Flutter


Hey devs! 👋
If you’re building Flutter apps using Android Studio on Windows, you’ve definitely faced this:
Random red squiggles everywhere 🛑
Autocomplete slower than a boomer on dial-up 🐢
Code highlighting looking like it’s had too much caffeine ☕
First, don’t panic it’s not just you. It’s actually a pretty common issue. And yes, there’s a pretty simple fix.
So… what’s happening?
Turns out, it’s a line endings issue.
Windows uses CRLF (\r\n
) for line endings while Linux and macOS use LF (\n
).
For whatever reason, Flutter's plugins in Android Studio on Windows get super confused when they see CRLF. The code analyzer freaks out, autocomplete slow down & red errors pop up when your code is perfectly fine. It’s a whole mess 👹
The Quick Fix (aka the basic fix)
Step 1:
Manually switch line endings for your files to LF.
In Android Studio:
File > File Properties > Line Separators > LF - Unix and macOS (\n)
Boom. Immediate improvement.
BUT — changing every file manually?
❌ Hard pass. Ain’t nobody got time for that.
The Proper Fix (aka my glow-up solution ✨)
If you wanna fix it properly for your whole project and never deal with this again, here’s how:
1. Create a .gitattributes
File to Enforce LF Line Endings
In your project’s root directory, create a .gitattributes
file and add the following:
# Enforce LF endings for all text files
* text=auto eol=lf
# Specific text files
*.dart text eol=lf
*.yaml text eol=lf
# Dart gen files (keep text, force LF if needed)
*.g.dart text eol=lf
*.freezed.dart text eol=lf
This tells Git to enforce LF line endings for all text files. It ensures that files like .dart
and .yaml
use LF endings. For generated Dart files like .g.dart
and .freezed.dart
, it keeps them as text and forces LF if needed.
✅ Always use LF endings.
✅ This applies to generated Dart files and YAML files too.
2. Configure Git to Handle Line Endings Automatically
Run the following command in your terminal to ensure Git automatically handles line endings:
git config --global core.autocrlf input
This makes sure Git converts CRLF to LF automatically when you commit, but doesn’t touch your working files unless needed. Clean and drama-free.
3. Normalize Your Files to Apply the New Line Ending Rules
Now that you’ve set up the .gitattributes
and Git configuration, it's time to normalize the files. This ensures that all files in your project follow the LF line ending rule.
Run the following commands:
git add --renormalize .
git commit -m "Apply line endings rules with .gitattributes"
This "renormalizes" all your files according to the new rules you just set up and this will adjust the line endings of all files in your project based on the new .gitattributes
rules.
That’s it. You're done. 🎯
From now on:
Android Studio won’t randomly flip out anymore.
Autocomplete will be snappy again.
Your project will be healthier across all systems (Windows, Mac, Linux).
Bonus: if you work with a team, everyone will have consistent line endings, and merge conflicts will cry themselves to sleep.
TL;DR 🚀
Problem:
Windows + Flutter + CRLF = 🔥💀
Solution:
Switch to LF line endings using .gitattributes
+ git config. Normalize your project. Live happily ever after.
If you're dealing with performance issues while building Flutter apps on Windows using Android Studio, it's likely due to line ending discrepancies. Windows uses CRLF, while Linux and macOS use LF, causing confusion for Flutter's plugins. The quick solution is to switch to LF line endings manually in Android Studio, but a more robust fix involves creating a .gitattributes file to enforce LF line endings across your project automatically. This ensures consistent line endings, reduces errors, and enhances performance across platforms.
Want to connect or see more of my work?
Check out my GitHub profile for more projects and contributions.
Subscribe to my newsletter
Read articles from Akshat Bhuhagal directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Akshat Bhuhagal
Akshat Bhuhagal
I am a Android & Flutter Developer focused on user‑friendly experiences & passionate about building excellent software that improves the lives of those around me.