Skip to content

Commit

Permalink
Update path_utils.dart
Browse files Browse the repository at this point in the history
- add a method for get file extension
  • Loading branch information
thiagocarvalhodev committed Jan 29, 2024
1 parent 286d636 commit 9e43c83
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/src/utils/path_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ String getFileExtension({
required String contentType,
bool withExtensionDot = true,
}) {
String ext = path.extension(name);
String ext = getFileExtensionFromFileName(fileName: name);

if (ext.isNotEmpty) {
if (withExtensionDot) {
Expand All @@ -88,6 +88,10 @@ String getFileExtension({
}
}

String getFileExtensionFromFileName({required String fileName}) {
return path.extension(fileName);
}

String getFileTypeFromMime({required String contentType}) {
return contentType.substring(contentType.lastIndexOf('/') + 1);
}
Expand Down

0 comments on commit 9e43c83

Please sign in to comment.