Answers for "get file name from path dart"

1

flutter get file name

import 'package:path/path.dart';

File file = new File("/dir1/dir2/file.ext");
String basename = basename(file.path);
# file.ext
Posted by: Guest on April-20-2021
0

get file name from path dart

void main() {
  var completePath = "/dev/dart/work/hello/app.dart";
  var fileName = (completePath.split('/').last);
  var filePath = completePath.replaceAll("/$fileName", '');
  print(fileName);
  print(filePath);
}
Posted by: Guest on September-12-2020

Code answers related to "get file name from path dart"

Code answers related to "Dart"

Browse Popular Code Answers by Language