how chacke on the extension of file flutter code example

Example 1: 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);
}

Example 2: flutter file full name

File file = new File("/storage/emulated/0/Android/data/my_app/files/Pictures/ca04f332.png"); 
String fileName = file.path.split('/').last;

print(fileName);

Tags:

Dart Example