Simple library for generating random ascii strings.
A simple usage example:
import 'package:random_string/random_string.dart' as random;
main() {
print(randomBetween(10,20)); // some integer between 10 and 20
print(randomNumeric(4)); // sequence of 4 random numbers i.e. 3259
print(randomString(10)); // random sequence of 10 characters i.e. e~f93(4l-
print(randomAlpha(5)); // random sequence of 5 alpha characters i.e. aRztC
print(randomAlphaNumeric(10)); // random sequence of 10 alpha numeric i.e. aRztC1y32B
}
Please file feature requests and bugs at the issue tracker.
example/random_string_example.dart
// Copyright (c) 2016, Damon Douglas. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.
import 'package:random_string/random_string.dart';
main() {
print(randomBetween(10, 20)); // some integer between 10 and 20
print(randomNumeric(4)); // sequence of 4 random numbers i.e. 3259
print(randomString(10)); // random sequence of 10 characters i.e. e~f93(4l-
print(randomAlpha(5)); // random sequence of 5 alpha characters i.e. aRztC
print(randomAlphaNumeric(
10)); // random sequence of 10 alpha numeric i.e. aRztC1y32B
}
Add this to your package's pubspec.yaml file:
dependencies:
random_string: ^0.0.2
You can install packages from the command line:
with pub:
$ pub get
with Flutter:
$ flutter packages get
Alternatively, your editor might support pub get
or flutter packages get
.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:random_string/random_string.dart';
Version | Uploaded | Documentation | Archive |
---|---|---|---|
0.0.2 | Oct 15, 2018 |
|
|
0.0.1 | Apr 13, 2016 |
|
|
Popularity:
Describes how popular the package is relative to other packages.
[more]
|
92
|
Health:
Code health derived from static analysis.
[more]
|
99
|
Maintenance:
Reflects how tidy and up-to-date the package is.
[more]
|
81
|
Overall:
Weighted score of the above.
[more]
|
92
|
We analyzed this package on Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, web, other
No platform restriction found in primary library
package:random_string/random_string.dart
.
Fix lib/random_string.dart
. (-1 points)
Analysis of lib/random_string.dart
reported 2 hints:
line 43 col 42: Use =
to separate a named parameter from its default value.
line 43 col 63: Use =
to separate a named parameter from its default value.
Package is pre-v0.1 release. (-10 points)
While nothing is inherently wrong with versions of 0.0.*
, it might mean that the author is still experimenting with the general direction of the API.
The package description is too short. (-9 points)
Add more detail to the description
field of pubspec.yaml
. Use 60 to 180 characters to describe the package, what it does, and its target use case.
Package | Constraint | Resolved | Available |
---|---|---|---|
Direct dependencies | |||
Dart SDK | >=1.0.0 <3.0.0 |