Roll custom random string for Dart 2
This commit is contained in:
parent
f05fbfad5e
commit
63e63e438e
4 changed files with 19 additions and 4 deletions
|
@ -4,7 +4,7 @@ import "package:args/command_runner.dart";
|
|||
import 'package:io/ansi.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:prompts/prompts.dart' as prompts;
|
||||
import 'package:random_string/random_string.dart' as rs;
|
||||
import '../random_string.dart' as rs;
|
||||
import '../util.dart';
|
||||
import 'key.dart';
|
||||
import 'pub.dart';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'dart:io';
|
||||
import 'package:args/command_runner.dart';
|
||||
import 'package:random_string/random_string.dart' as rs;
|
||||
import '../random_string.dart' as rs;
|
||||
|
||||
class KeyCommand extends Command {
|
||||
@override
|
||||
|
|
15
lib/src/random_string.dart
Normal file
15
lib/src/random_string.dart
Normal file
|
@ -0,0 +1,15 @@
|
|||
import 'dart:math';
|
||||
|
||||
const String _valid =
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
final Random _rnd = new Random.secure();
|
||||
|
||||
String randomAlphaNumeric(int length) {
|
||||
var b = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
b.writeCharCode(_valid.codeUnitAt(_rnd.nextInt(_valid.length)));
|
||||
}
|
||||
|
||||
return b.toString();
|
||||
}
|
|
@ -4,7 +4,7 @@ homepage: https://github.com/angel-dart/angel_cli
|
|||
name: angel_cli
|
||||
version: 1.3.0
|
||||
dependencies:
|
||||
# analyzer: ^0.29.0
|
||||
analyzer: ">=0.32.0"
|
||||
args: ^1.0.0
|
||||
code_builder: ^3.0.0
|
||||
dart_style: ^1.0.0
|
||||
|
@ -18,7 +18,7 @@ dependencies:
|
|||
path: ^1.0.0
|
||||
prompts: ^1.0.0
|
||||
pubspec_parse: ^0.1.2
|
||||
random_string: ^0.0.1
|
||||
quiver: ">=0.29.0"
|
||||
recase: ^1.0.0
|
||||
watcher: ^0.9.7
|
||||
yaml: ^2.0.0
|
||||
|
|
Loading…
Reference in a new issue