resumeProgressInfo method
恢复上传进度,注意这里还是需要自行调用 startUpload 方法
Implementation
void resumeProgressInfo(Map progress) {
final localPath = progress['localPath'] as String;
final remotePath = progress['remotePath'] as String;
final memberLevel = progress['memberLevel'] as int;
final saveFileLength = progress['saveFileLength'] as int;
final lastModifiedMs = progress['lastModified'] as int;
if (lastModifiedMs != lastModified.millisecondsSinceEpoch) {
throw Exception('修改时间不一致,可能文件被修改过,不支持续传');
}
if (saveFileLength != fileTotalSize) {
throw Exception('文件大小不一致,可能文件已经被修改,不支持续传');
}
// 读取上传的文件的 md5 码
if (localPath != this.localPath || remotePath != this.remotePath) {
throw Exception('localPath or remotePath is not equal');
}
if (memberLevel != this.memberLevel) {
throw Exception('memberLevel 不一致,可能会造成分块大小不同,所以不支持续传');
}
_uploadId = progress['uploadId'];
// 恢复生成的 md5 值
_md5 = BaiduMd5.fromMap(progress['md5']);
uploadCount = progress['uploadCount'] as int;
}