How can I get the name of a file in Dart?
You can use the path package :
import 'dart:io';
import 'package:path/path.dart';
main() {
File file = new File("/dev/dart/work/hello/app.dart");
String filename = basename(file.path);
}
If you don't want to use the path pub package, you can use the Uri class from dart:io that returns the filename and its extension:
String fileName = File(localFilePath).uri.pathSegments.last;