Files
EasyDesignCollection/tool/check_update.dart
T
admin fe2008b604 fix(ui): 修复「适应视图」条形视图缩小后偏到左上角;发布 v1.2.3
- fitView 条形分支:内容被缩小时按内容范围居中显示
  (此前固定 pan=0,动作较多触发缩小时画面会钉在左上角)
- 圆周视图行为不变(原本即按圆心居中计算)
- tool/check_update.dart 改用 package 导入并声明 ignore,flutter analyze 归零
- 版本号 1.2.3+15
2026-10-09 10:24:48 +08:00

34 lines
1.5 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 开发自检工具:直接调用应用内更新服务,检查服务器上的最新版本。
//
// 用途:验证更新链路(网络可达 / 接口解析 / 版本判定 / 附件匹配)。
// 运行:
// dart run tool\check_update.dart # 用当前版本检查
// dart run tool\check_update.dart 1.2.1 # 模拟旧版本,验证「发现更新」路径
//
// 说明:使用的是与客户端完全相同的 lib/update/update_service.dart;
// 本文件是命令行工具,直接向控制台打印结果属预期用法。
//
// ignore_for_file: avoid_print
import 'package:sequence_diagram/update/update_service.dart';
import 'package:sequence_diagram/version.dart';
Future<void> main(List<String> args) async {
// 可传入一个版本号模拟旧安装(如 `dart run tool\check_update.dart 1.2.1`)。
final String current = args.isNotEmpty ? args.first : kAppVersion;
print('当前版本(模拟): $current');
try {
final UpdateInfo? info = await UpdateService.check(currentVersion: current);
if (info == null) {
print('结果: 已是最新版本(服务器无更高版本或缺少当前平台的安装包)');
return;
}
print('结果: 发现新版本 v${info.version}');
print('安装包: ${info.assetName} ${(info.assetSize / 1048576).toStringAsFixed(1)} MB');
print('下载地址: ${info.assetUrl}');
print('---- 更新说明 ----');
print(info.notes.trim());
} catch (e) {
print('检查失败: $e');
}
}