添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
温文尔雅的绿豆  ·  搜索结果-隧道网·  1 周前    · 
快乐的卤蛋  ·  探索《The Last of Us》 | ...·  5 月前    · 
考研的猕猴桃  ·  ROG STRIX Z790-I ...·  5 月前    · 

使用系统API获取文件路径相关的信息

Use the basename() , dirname() , basenameWithoutExtension() , and extension() methods defined in the path Pub package when working with a file path.

import 'package:path/path.dart' as path;
import 'dart:io';
main() async {
  // Create dir/ and dir/file.txt in the system temp directory.
  var file = await new File('${Directory.systemTemp.path}/dir/myFile.txt')
      .create(recursive: true);
  print(path.basename(file.path)); // Prints 'file.txt'.
  print(path.dirname(file.path)); // Prints path ending with 'dir'.
  print(path.basenameWithoutExtension(file.path)); // Prints 'myFile'.
  print(path.extension(file.path)); // Prints '.txt'.