ops-console v1.0.2 (versionCode 8) 源码入库

This commit is contained in:
txh
2026-09-03 18:01:05 +08:00
commit 685fff27c8
170 changed files with 53049 additions and 0 deletions

17
lib/utils/uuid.dart Normal file
View File

@@ -0,0 +1,17 @@
import 'dart:math';
/// 生成与 web 前端一致的 UUID v4 字符串。
///
/// 模板:`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`
String generateUuid() {
final random = Random.secure();
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replaceAllMapped(
RegExp('[xy]'),
(match) {
final r = random.nextInt(16);
final c = match.group(0)!;
final v = c == 'x' ? r : (r & 0x3) | 0x8;
return v.toRadixString(16);
},
);
}