updateProgress static method
dynamic
updateProgress(
- String? id,
- int progress
)
Implementation
static updateProgress(String? id, int progress) async {
PersonChat getChat = chat.where((element) => element.chatType.idFile == id).first;
final task = await FlutterDownloader.loadTasksWithRawQuery(query: 'SELECT * FROM task WHERE task_id="$id"');
getChat.chatType.progress = progress;
if (progress >= 100) {
String dir = await getPhoneDirectory(path: '', platform: 'android');
getChat.chatType.status = 1;
getChat.chatType.path = dir + (task?.first.filename ?? '');
if (getChat.chatType.file == Files.video) {
getChat.chatType.thumnailMemory = await VideoThumbnail.thumbnailData(
video: dir + (task!.isNotEmpty ? (task.first.filename ?? '') : ''),
imageFormat: ImageFormat.JPEG,
maxWidth: 100, // specify the width of the thumbnail, let the height auto-scaled to keep the source aspect ratio
quality: 25,
);
}
}
await ChatDatabase.progressUpdate(id: id, progress: progress, idList: getChat.listId);
}