• Tess Strickland's avatar
    Mark defaultTargetPlatform as constant for non-debug non-web builds. (#141105) · 7ca4b7b8
    Tess Strickland authored
    This PR adds the Dart VM `vm:platform-const-if` pragma introduced in
    https://github.com/dart-lang/sdk/commit/57a1168875 to the
    `defaultTargetPlatform` property, allowing it to be computed as if it
    was a constant field in non-debug AOT builds. In particular, this means
    that platform-specific code executed conditionally based on this
    property can be tree-shaken in release builds. Note that this PR changes
    `defaultTargetPlatform` to only allow overriding via
    `debugDefaultTargetPlatformOverride` in debug builds, and makes it so
    that compilation throws an error if code assigns
    to`debugDefaultTargetPlatformOverride` in other build modes.
    
    Related issue: #14233
    
    ## Pre-launch Checklist
    
    - [X] I read the [Contributor Guide] and followed the process outlined
    there for submitting PRs.
    - [X] I read the [Tree Hygiene] wiki page, which explains my
    responsibilities.
    - [X] I read and followed the [Flutter Style Guide], including [Features
    we expect every widget to implement].
    - [X] I signed the [CLA].
    - [X] I listed at least one issue that this PR fixes in the description
    above.
    - [X] I updated/added relevant documentation (doc comments with `///`).
    - [X] I added new tests to check the change I am making, or this PR is
    [test-exempt].
    - [X] All existing and new tests are passing.
    7ca4b7b8
Name
Last commit
Last update
..
README.md Loading commit data...
_bitfield_io.dart Loading commit data...
_bitfield_web.dart Loading commit data...
_capabilities_io.dart Loading commit data...
_capabilities_web.dart Loading commit data...
_isolates_io.dart Loading commit data...
_isolates_web.dart Loading commit data...
_platform_io.dart Loading commit data...
_platform_web.dart Loading commit data...
_timeline_io.dart Loading commit data...
_timeline_web.dart Loading commit data...
annotations.dart Loading commit data...
assertions.dart Loading commit data...
basic_types.dart Loading commit data...
binding.dart Loading commit data...
bitfield.dart Loading commit data...
capabilities.dart Loading commit data...
change_notifier.dart Loading commit data...
collections.dart Loading commit data...
consolidate_response.dart Loading commit data...
constants.dart Loading commit data...
debug.dart Loading commit data...
diagnostics.dart Loading commit data...
isolates.dart Loading commit data...
key.dart Loading commit data...
licenses.dart Loading commit data...
memory_allocations.dart Loading commit data...
node.dart Loading commit data...
object.dart Loading commit data...
observer_list.dart Loading commit data...
persistent_hash_map.dart Loading commit data...
platform.dart Loading commit data...
print.dart Loading commit data...
serialization.dart Loading commit data...
service_extensions.dart Loading commit data...
stack_frame.dart Loading commit data...
synchronous_future.dart Loading commit data...
timeline.dart Loading commit data...
unicode.dart Loading commit data...