Skip to content

Commit

Permalink
Improve conditional import export docs (#6228)
Browse files Browse the repository at this point in the history
Improve conditional import/export docs

Related to dart-lang/sdk#59575

---

Co-authored-by: Marya <[email protected]>
  • Loading branch information
mcmah309 and MaryaBelanger authored Nov 25, 2024
1 parent 771459b commit d035064
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/content/guides/libraries/create-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,12 @@ To conditionally import a file, use the same code as above,
but change `export` to `import`.

:::note
The conditional import or export checks only whether the library is
_available for use_ on the current platform,
not whether it's actually imported or used.
Conditional imports or exports only work with keys in the compilation
environment. Any sequence of dot-separated identifiers is valid syntax.
Currently, only keys of the form `dart.library.name` are provided.
`dart.library.name` is set to `"true"` in the compilation
environment if the library `dart:name` is _available for use_ on
the current platform, not whether it's actually imported or used.
:::

All of the conditionally exported libraries must implement the same API.
Expand Down

0 comments on commit d035064

Please sign in to comment.