File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -34,3 +34,4 @@ export 'src/util/equatable.dart';
34
34
export 'src/util/json.dart' ;
35
35
export 'src/util/print.dart' ;
36
36
export 'src/util/serializable.dart' ;
37
+ export 'src/util/uuid.dart' ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ import 'package:uuid/uuid.dart' ;
16
+ import 'package:uuid/uuid_util.dart' ;
17
+
18
+ /// Generates a crypto-secure UUID (v4).
19
+ String uuid () => const Uuid ().v4 (
20
+ // Use the crypto-secure RNG per `package:uuid` docs:
21
+ // https://github.com/Daegalus/dart-uuid/blob/d7bc930942afc752edd0fd15f8bf8234d81dfeda/example/example.dart#L21
22
+ options: const < String , Object > {
23
+ 'rng' : UuidUtil .cryptoRNG,
24
+ },
25
+ );
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ dependencies:
12
12
collection : ^1.15.0
13
13
http : ^0.13.4
14
14
meta : ^1.7.0
15
+ uuid : 3.0.6
15
16
16
17
dev_dependencies :
17
18
amplify_lints : ^1.0.0
You can’t perform that action at this time.
0 commit comments