From d0350646bec806d1ddb7e88060d50f7c1933e841 Mon Sep 17 00:00:00 2001 From: Henry <56412856+mcmah309@users.noreply.github.com> Date: Mon, 25 Nov 2024 22:22:01 +0000 Subject: [PATCH] Improve conditional import export docs (#6228) Improve conditional import/export docs Related to https://github.com/dart-lang/sdk/issues/59575 --- Co-authored-by: Marya <111139605+MaryaBelanger@users.noreply.github.com> --- src/content/guides/libraries/create-packages.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/content/guides/libraries/create-packages.md b/src/content/guides/libraries/create-packages.md index 44e686fad4..40a5bd2385 100644 --- a/src/content/guides/libraries/create-packages.md +++ b/src/content/guides/libraries/create-packages.md @@ -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.