获取绝对路径

获取绝对路径

Use Platform.script to get the absolute URI of the script being run in the current isolate.

import 'dart:io' show Platform;

main() {
  // Get the URI of the script being run.
  var uri = Platform.script;
  print(uri); // Prints something like '/Users/shailentuli/workspace/...'.

  // Convert the URI to a path.
  var path = uri.toFilePath();
  print(
      path); // Prints something like 'file:///Users/shailentuli/workspace/...'.
}

手机扫码阅读