You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow plugin authors to force their code to only execute in development/ dev_dependencies #23154
Hey there -- I have a plugin (flutter_stetho) that should be used only during development for inspecting Network requests and Databases for Flutter apps.
I ask users to use a main.dart and main_dev.dart so they can instantiate the code only during their dev process, and to include the plugin only in the dev_dependencies section in the pubspec.yaml file.
However, if you build the app in production mode using the main.dart entry point, I believe the Dart code will be properly removed / tree shaken, but the Android plugin code is still being shipped. That makes the app size larger, and potentially makes Stetho a security risk (might accidentally allow users to inspect the Database or network requests)
Is there a way for plugin authors to indicate to Flutter: "Hey, only include this Android/iOS for Dev builds, but not for production builds"?
Also, more of a General Question: I was a bit confused as to why dev_dependencies are being included in Production builds at all. Is this by design? If so, could you describe why / when those are included?
changed the title [-]Remove Plugin in Production Build[/-][+]Allow plugin authors to force their code to only execute in development/ dev_dependencies[/+]on Jan 18, 2020
@jonahwilliams Does that one need to be re-titled then and this one duped over? I can't say I got the request from the "native buildscripts" part (at least for iOS, this would require changing CocoaPods logic):
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
[-]Remove Plugin in Production Build[/-][+]Allow plugin authors to force their code to only execute in development/ dev_dependencies[/+]jmagman commentedon Jan 18, 2020
I split out that last question about dev_dependencies re: iOS to #49101
jonahwilliams commentedon Jan 18, 2020
I think this is essentially the same as #45714
jmagman commentedon Jan 21, 2020
@jonahwilliams Does that one need to be re-titled then and this one duped over? I can't say I got the request from the "native buildscripts" part (at least for iOS, this would require changing CocoaPods logic):
jonahwilliams commentedon Jan 21, 2020
I think it is similar in spirit. Though FWIW I think it would be a mistake to conditionally include dependencies based on runtime mode
jonahwilliams commentedon Sep 26, 2020
Closing as a duplicate of #45714
github-actions commentedon Aug 12, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.