3

I'm using MobX for my flutter project and it needs build_runner to generate related files, now I have hundred auto-generated files, now I want to remove them all, What command can lean my project from these files?

I'm using following command to generate the files:

flutter packages pub run build_runner watch --delete-conflicting-outputs

By saying auto-generated files I mean files with this formats: *.g.dart, *.inject.summary , ...

Alireza Akbari
  • 2,153
  • 2
  • 28
  • 53

4 Answers4

6

I did not find a valid solution, so I used bash to remove mentioned files using this command and use it on terminal:

find . -maxdepth 20 -type f \( -name "*.inject.summary" -o -name "*.inject.dart" -o  -name "*.g.dart" \) -delete

You can also add it to the aliases: (and use by typing rmAll command in terminal)

alias rmAll='find . -maxdepth 20 -type f \( -name "*.inject.summary" -o -name "*.inject.dart" -o  -name "*.g.dart" \) -delete'

You can add your favorite file type by adding it's extension before the second parenthesis by this format: -o -name "*.XXX"

Alireza Akbari
  • 2,153
  • 2
  • 28
  • 53
3

A solution that works for me

flutter pub run build_runner clean
flutter pub run build_runner build --delete-conflicting-outputs
LilSheep
  • 31
  • 3
1

flutter packages pub run build_runner build --delete-conflicting-outputs

try running this and when files are deleted ctrl c/option c to interrupt building. works for me

Ilya Maximencko
  • 411
  • 2
  • 15
-2

You can try this, It's work for me

flutter clean

flutter build ios
Rohit Soni
  • 1,300
  • 6
  • 12