pathパッケージをimportして、
import 'package:path/path.dart';
basenameを使う。
File file = File("dir/name.png");
print(basename(file.path));
/// output:
/// name.png
参考
- https://stackoverflow.com/a/50439988
- https://pub.dartlang.org/documentation/path/1.3.6//path/path-library.html