random_string_one 1.0.2

random_string #

A package which allows for modular control over random string generation.

Getting Started #

To use random_string, simply import the package and call the randomString() function with a desired length and optional parameters. randomString() will return a String that respects your arguments.

Parameters #

int length: the number of characters that will be present in the returned string<br/> bool includeNumbers: defaults to true; specifies whether numbers will appear in the string result<br/> bool includeLowercase: defaults to true; specifies whether lowercase letters will appear in the string result<br/> bool includeUppercase: defaults to true; specifies whether uppercase letters will appear in the string result<br/> bool includeSymbols: defaults to true; specifies whether symbols will appear in the string result<br/> bool useCharOnce: defaults to false; specifies whether any character may appear more than once<br/> int seed: defaults to null; seed to be used for random generation<br/> Set exclusions: defaults to null; specific character exclusions that are not to be present in the result<br/>

1.0.1 #

  • Updated to better conform to Pub publishing conventions after initial release

1.0.2 #

  • Fixed silly boolean inversion mistake


Example #

See three example usages of randomString() in example/main.dart. Each represents a different use case for specific random string generation using a single function.

import 'package:random_string_one/random_string.dart';

void main() {
  /// A 99-character string containing only alphanumeric characters.
  final myAlphaNumString = randomString(99, includeSymbols: false);

  /// A 16-character string containing any printable character.
  final myString = randomString(16);

  /// A 10-character string containing only numbers, except 0 and 1.
  final myNumericString = randomString(
    includeSymbols: false,
    includeLowercase: false,
    includeUppercase: false,
    exclusions: {'0', '1'},


Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  random_string_one: ^1.0.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:random_string_one/constants.dart';
import 'package:random_string_one/random_string.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Aug 14, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19


Detected platforms: Flutter, web, other

No platform restriction found in libraries.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2<3.0.0