搜索插件、代码仓与 APP 分类

插件详情v1.1.0

sane_uuid

一个合理的 UUID 实现,支持根据 RFC4122 生成和处理 v1、v4 和 v5 UUID。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2.4万
喜欢数
4
Pub 分数
160

安装插件

flutter pub add sane_uuid

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个干净简洁的 Dart 和 Flutter UUID 库,符合 RFC4122 标准。它支持生成和解析版本 1、4 和 5 的 UUID,拥有简单直观的 API。专为所有主要平台设计,确保在需要唯一标识符的应用程序中一致地处理 UUID。该包强调清晰性和正确性,避免不必要的复杂性。

适合场景

  • 为用户会话生成唯一ID
  • 在数据库中创建持久标识符
  • 实现安全令牌生成
  • 在设备间同步数据
  • 跨平台应用中的UUID处理

主要特点

  • 支持 UUID 版本 1、4 和 5
  • 符合 RFC4122
  • 简单且可读的 API
  • 跨平台兼容性
  • 强大的解析和验证
  • 轻量且无依赖

适合对象

  • 需要唯一标识符的应用程序
  • 使用UUID的后端服务
  • 数据同步功能
  • 安全的身份验证系统
  • 跨平台开发

使用建议

  • 不支持 UUID 版本 3
  • 仅限标准UUID格式
  • 除了解析之外,没有内置的UUID验证工具
  • 不适用于高性能批量UUID生成

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

sane_uuid

codecov

A properly designed, efficient UUID library for Dart.

  • Supports v1, v4, v5 and v6 generation
  • Immutable Uuid type with equality, comparison and accessors for properties defined by RFC 4122
    • The internal representation of the UUID is a byte array, not a String
  • Support for all syntactically correct UUIDs (regardless of RFC4122 semantics)

Usage

A simple usage example:

import 'package:sane_uuid/uuid.dart';

// randomly generated using secure random number generator
final Uuid randomUuid = Uuid.v4();
// Prints properly formatted UUID, e.g.: a8796ef4-8767-4cd0-b432-c5e93ba120df
print(randomUuid);

// parse any common UUID string
final parsedUuid = Uuid.fromString(
  'a8796ef4-8767-4cd0-b432-c5e93ba120df',
);

// hyphens and capitalization don't matter
final parsedUuidDifferentFormatting = Uuid.fromString(
    'A8796EF487674CD0B432C5E93BA120DF',
);

// UUID objects with the same data are actually equal
assert(parsedUuid == parsedUuidDifferentFormatting);

For more examples, see the examples page.

Features and bugs

Please file feature requests and bugs at the issue tracker.

License

This project is released under the MIT License. That includes every file in this repository, unless explicitly stated otherwise at the top of a file. A copy of the license text can be found in the LICENSE file.

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。