3

【笔记】Dart 生成 UUID

 10 months ago
source link: https://loli.fj.cn/2023/08/04/Dart%E7%94%9F%E6%88%90UUID/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

【笔记】Dart 生成 UUID

2023-08-04 2023-08-06

Dart 生成 UUID

dart pub get uuid
import 'package:uuid/uuid.dart';

通过当前时间生成 UUID

var uuid = Uuid().uuid.v1();

通过随机数生成 UUID

var uuid = Uuid().uuid.v4();

通过命名空间 SHA1 值生成 UUID

<str>:字符串

var uuid = Uuid().uuid.v5(Uuid.NAMESPACE_URL, "<str>");

pub.dev


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK