Last active
July 16, 2020 02:17
-
-
Save codinghivedev/f0fb53de9524264f5311e2e80ad29c22 to your computer and use it in GitHub Desktop.
To get file name in Flutter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:path/path.dart' as path; | |
| class AppUtil{ | |
| static Future<String> getFileNameWithExtension(File file)async{ | |
| if(await file.exists()){ | |
| //To get file name without extension | |
| //path.basenameWithoutExtension(file.path); | |
| //return file with file extension | |
| return path.basename(file.path); | |
| }else{ | |
| return null; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment