Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Unified Diff: sdk/lib/io/platform.dart

Issue 1334353002: - Add getters for the current packageRoot or packageMap. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Updated documentation comment. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/io/platform.dart
diff --git a/sdk/lib/io/platform.dart b/sdk/lib/io/platform.dart
index 56ddea0193b0df98b43e703e0c98828f4eb1e696..e94ba4c08e21fa1ba7d9a0e8d1ff39fae5983a5a 100644
--- a/sdk/lib/io/platform.dart
+++ b/sdk/lib/io/platform.dart
@@ -176,13 +176,26 @@ class Platform {
static List<String> get executableArguments => _Platform.executableArguments;
/**
- * Returns the value of the --package-root flag passed to the executable
- * used to run the script in this isolate. This is the directory in which
- * Dart packages are looked up.
+ * Returns the package root of the current isolate, if any.
*
- * If there is no --package-root flag, then the empty string is returned.
+ * If the isolate is using a [packageMap], this getter returns `null`,
+ * otherwise it returns the package root - a directory that package
+ * URIs are resolved against.
*/
- static String get packageRoot => _Platform.packageRoot;
+ static Future<Uri> get packageRoot => _Platform.packageRoot;
+
+ /**
+ * Returns the package mapping of the current isolate, if any.
+ *
+ * If the current isolate is using [packageRoot], this getter returns `null`.
+ *
+ * The package map maps the name of a package that is available to the
+ * program, to a URI that package URIs for that package are resolved against.
+ *
+ * Returns an empty map if the isolate does not have a way to resolve package
+ * URIs.
+ */
+ static Future<Map<String, Uri>> get packageMap => _Platform.packageMap;
/**
* Returns the version of the current Dart runtime.

Powered by Google App Engine
This is Rietveld 408576698