slugid 1.0.0 slugid: ^1.0.0 copied to clipboard
A URL-safe base64 encoding for UUIDv4 stripped of padding. Useful when embedding short random UUIDs in URLs.
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import 'package:slugid/slugid.dart';
void main() {
print('Generating 5 random slugids:');
for (int i = 0; i < 5; i++) {
// Using the _nice_ variant, which cannot start with dashes, this is always
// nice if for some reason the ID might be given as commandline argument in
// some tool some day.
print(Slugid.nice());
}
}