downloadMedia method
Implementation
Future<void> downloadMedia() async {
state = state.copyWith(isDownloading: true);
//Download media if media path is not available
final tempDir = await getTemporaryDirectory();
final mediaPath =
(await attachment.downloadMedia(null, tempDir.path)).text();
if (mediaPath != null) {
state = state.copyWith(mediaFile: File(mediaPath), isDownloading: false);
}
}