Skip to content

Instantly share code, notes, and snippets.

@Adem68
Last active April 15, 2025 15:55
Show Gist options
  • Save Adem68/a98feed31ad1ce38b9733f5d548526a9 to your computer and use it in GitHub Desktop.
Save Adem68/a98feed31ad1ce38b9733f5d548526a9 to your computer and use it in GitHub Desktop.
How many lines does your Flutter project have?
  • Open terminal and go to your project's lib folder. After that run the command below.
  • find . -name '*.dart' ! -name '*.g.dart' ! -name '*.freezed.dart' ! -name '*.gr.dart' ! -name '*.gen.dart' | xargs wc -l

Thanks @AcetylsalicylicAcid for excluding generated files.

@Ayu219
Copy link

Ayu219 commented Sep 8, 2024

For Windows :

$files = Get-ChildItem -Recurse -Filter *.dart | Where-Object { $_.Name -notmatch '\.g\.dart$|\.freezed\.dart$|\.gr\.dart$|\.gen\.dart$' }
$totalLines = 0
foreach ($file in $files) {
    $lines = (Get-Content $file.FullName | Measure-Object -Line).Lines
    $totalLines += $lines
    Write-Output "$($file.FullName): $lines lines"
}
Write-Output "Total lines: $totalLines" 

@djsimp
Copy link

djsimp commented Apr 15, 2025

Why not this?:
$ find . -name '*.dart' ! -name '*.*.dart' | xargs wc -l

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment