Skip to main content

Build Output

This list gives you some tips to control and manage the generated files coming out of the build_runner.

Use the correct SDK version​

The version of the sdk used in the pubspec.yaml has a big influence on what packages are downloaded as part of the pub get command. Make sure you are using at least 2.12.0.

Continuous generation with the watch command​

As you work on your stores, you would want to keep the build_runner active, constantly generating the *.g.dart files. The trick to keep it running is to use the watch sub-command, as shown below:

flutter pub run build_runner watch

OR

pub run build_runner watch

Starting a clean build​

Sometimes build_runner will simply refuse to run the build if you already have some generated files. This could happen if the version of dart or flutter has changed. In those case, it is best to start clean and regenerate all the files. You can either use the clean sub-command or simply start off by deleting the existing generated files.

  • Clean and remove all generated files
flutter pub run build_runner clean
  • Delete conflicting files
flutter pub run build_runner watch --delete-conflicting-outputs

Unable to run the app in iOS Simulator (Old iOS Deployment Target)​

It is possible that sometimes your app would simply fail to run on the simulator. You might see a weird error message like so:

info flutter.tools [ +206 ms] An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
info flutter.tools Failed to install the requested application
info flutter.tools The application's Info.plist does not contain CFBundleVersion.
info flutter.tools Ensure your bundle contains a CFBundleVersion with a valid semantic version number.

The real issue seems to be the fact that the Deployment Target has been set to iOS 8.0. This should be at least 12.0. Open up the Runner.xcworkspace file in XCode and change the deployment target as below:

  • Once you make this change, be sure to remove the app from your simulator and restart the simulator.
  • With that change, you should be back in action!