Implementation
void onDeleteFile(BuildContext context,String path, bool isDirectory) async {
var document = isDirectory ? Directory(path) : File(path);
await document
.delete(recursive: true)
.then(
(value) => createSnackBar(context,
message: StyleMyFile.snackBarSuccessfullyDeleted,
backgroundColor: StyleMyFile.snackBarSuccessColor,
),
).catchError(
(error) => createSnackBar(context,
message: StyleMyFile.snackBarDeletingError,
backgroundColor: StyleMyFile.snackBarErrorColor,
),
).whenComplete(() => updateFilesList());
}