Description
What information needs to be added?
Would it be possible to say somewhere that code guarded with checks against defaultTargetPlatform
, e.g.,
if (defaultTargetPlatform == TargetPlatform.windows) {
/* Windows-specific code here */
}
or
switch (defaultTargetPlatform) {
case TargetPlatform.windows:
/* Windows-specific code here */
break;
...
}
are appropriately tree-shaken in release builds of Flutter applications (and so dependencies used only in code guarded by such checks should also be tree-shaken, etc.)?
Where should this new content appear?
Currently it looks like the only examples of code using defaultTargetPlatform
are in https://docs.flutter.dev/platform-integration/macos/platform-views and https://docs.flutter.dev/platform-integration/ios/platform-views, and https://docs.flutter.dev/platform-integration/platform-channels only mentions defaultTargetPlatform
in a sidebar, so I'm unsure if those are the right places or not, or if this should be relegated to the defaultTargetPlatform
/TargetPlatform
API docs.
See dart-lang/sdk#31969 (comment) for the original request, and see flutter/flutter#14233 (comment) for more background. Let me know if there's anything I can do to help, or if there's some place I should file this instead. Thanks!
I would like to fix this problem.
- I will try and fix this problem on docs.flutter.dev.
Activity