I have a project where I want the mobile and desktop parts to be completely separate. My issue is with the pubspec.yaml file. How should I go about separating dependencies for macOS (or desktop versions), for example, and for iOS (or mobile versions)?
Thank you.
I tried to check the official documentation, but I couldn't find it. I tried adding a 'macos:' key in dependencies, but it didn't work. I tried to find where we can create another pubspec.yaml for desktop, but I couldn't find it.
The easiest way to solve that is to use melos
to make three packages adjacent in the same repository: common, mobile, desktop. 95% of your code will end up in common, which will be consumed by your mobile and desktop packages. Melos can help set that up. The mobile and desktop packages won't be much more than different pubspec.yaml, and maybe whatever startup code needs to be different, calling into the common main once that's done.