If you are using this package in production, then as of October 2023 with 2.1.0 it is still inconvenient to run an iOS simulator on Apple Silicon due to the lack of driver support / lack of understanding for how to enable it. I'm not talking about during implementation, I'm talking about after implementation. Various online suggestions such as setting 'EXCLUDED_ARCH' or whatever have not worked, after probably 6 dedicated hours of trying to figure out a solution.
At last, I just said screw it, and found a work-around. Sharing to help people save some time.
Basically, in your pubspec.yaml, you will want to comment out the another_brother reference, and also comment out any lines of code in the file(s) that reference another_brother code. If you use VS Code's debugger like I do, it has a couple of hooks you can tap into to run a bash script before setup and after tear down.
Inside my .vscode folder, this is what my launch.json file looks like.
My tasks.json looks like this.
{ "version": "2.0.0", "tasks": [ { "label": "dev_another_brother", "command": "sh ./dev_another_brother.sh", // Could be any other shell command "args": [], "type": "shell" }, { "label": "prod_another_brother", "command": "sh ./prod_another_brother.sh", // Could be any other shell command "args": [], "type": "shell" }, ] }
My dev_another_brother script in the root of my directory comments out the package reference in the pubspec, and renames a couple of files to pass in a 'dummy' printing file that is just a SizedBox and compiles, looks like this.
The 24 refers to line 24, as an fyi.
sed -i '' '24s/^/#/' pubspec.yaml && sed -i '' 's/^/\/\/ /' lib/screens/printing_demo.dart && mv lib/screens/printing_demo.dart lib/screens/disabled_printing_demo.dart && mv lib/screens/alt_printing_demo.dart lib/screens/printing_demo.dart && flutter pub get
My prod_another_brother script looks like this, which rolls everything back automatically after the debugger finishes.
sed -i '' 's/^\/\/ //' lib/screens/disabled_printing_demo.dart && sed -i '' '24s/^#//' pubspec.yaml && mv lib/screens/printing_demo.dart lib/screens/alt_printing_demo.dart && mv lib/screens/disabled_printing_demo.dart lib/screens/printing_demo.dart && flutter pub get && cd ios && pod install
This let's you run your app in development on a software simulator, without having to switch back and forth all the time when you want to deploy/run something locally. It is worth noting that, as of now, we still have no way of testing the functionality on a simulator - you will need to do that on a local device, and even then compiling on XCode wouldn't evenlet me test the functionality due to some weird software incompatibility. I had to test on Android, and then when I deployed to TestFlight for iOS, the same code worked just fine.
If you are using this package in production, then as of October 2023 with 2.1.0 it is still inconvenient to run an iOS simulator on Apple Silicon due to the lack of driver support / lack of understanding for how to enable it. I'm not talking about during implementation, I'm talking about after implementation. Various online suggestions such as setting 'EXCLUDED_ARCH' or whatever have not worked, after probably 6 dedicated hours of trying to figure out a solution.
At last, I just said screw it, and found a work-around. Sharing to help people save some time.
Basically, in your pubspec.yaml, you will want to comment out the
another_brother
reference, and also comment out any lines of code in the file(s) that reference another_brother code. If you use VS Code's debugger like I do, it has a couple of hooks you can tap into to run a bash script before setup and after tear down.Inside my
.vscode
folder, this is what mylaunch.json
file looks like.{ "version": "0.2.0", "configurations": [ { "name": "arms-mobile-ios", "preLaunchTask": "dev_another_brother", "postDebugTask": "prod_another_brother", "request": "launch", "type": "dart", "args": [ "--dart-define", "TEST=FALSE" ] }, { "name": "arms-mobile-android", "request": "launch", "type": "dart", "args": [ "--dart-define", "TEST=FALSE" ] } ] }
My
tasks.json
looks like this.{ "version": "2.0.0", "tasks": [ { "label": "dev_another_brother", "command": "sh ./dev_another_brother.sh", // Could be any other shell command "args": [], "type": "shell" }, { "label": "prod_another_brother", "command": "sh ./prod_another_brother.sh", // Could be any other shell command "args": [], "type": "shell" }, ] }
My
dev_another_brother
script in the root of my directory comments out the package reference in the pubspec, and renames a couple of files to pass in a 'dummy' printing file that is just a SizedBox and compiles, looks like this.The 24 refers to line 24, as an fyi.
sed -i '' '24s/^/#/' pubspec.yaml && sed -i '' 's/^/\/\/ /' lib/screens/printing_demo.dart && mv lib/screens/printing_demo.dart lib/screens/disabled_printing_demo.dart && mv lib/screens/alt_printing_demo.dart lib/screens/printing_demo.dart && flutter pub get
My
prod_another_brother
script looks like this, which rolls everything back automatically after the debugger finishes.sed -i '' 's/^\/\/ //' lib/screens/disabled_printing_demo.dart && sed -i '' '24s/^#//' pubspec.yaml && mv lib/screens/printing_demo.dart lib/screens/alt_printing_demo.dart && mv lib/screens/disabled_printing_demo.dart lib/screens/printing_demo.dart && flutter pub get && cd ios && pod install
This let's you run your app in development on a software simulator, without having to switch back and forth all the time when you want to deploy/run something locally. It is worth noting that, as of now, we still have no way of testing the functionality on a simulator - you will need to do that on a local device, and even then compiling on XCode wouldn't evenlet me test the functionality due to some weird software incompatibility. I had to test on Android, and then when I deployed to TestFlight for iOS, the same code worked just fine.