使用Join方法连接路径

4339次阅读  |  发布于3年以前

使用Join方法连接路径

Use the path Pub package, and use join() to create a new path from existing paths. Using join() ensures that the current platform's directory separator is used in the path.

import 'package:path/path.dart' as path;

main() {
  var newPath = path.join('/Users/shailen', 'dart/projects');
  print(newPath); // Prints '/Users.shailen/dart/projects'.
}

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8