Skip to content
pubscout

random_string

2.3.1, released 5 years ago by an unverified publisher

Generates random ASCII strings, numbers, and alphanumeric sequences for testing purposes.

WASM-ready
$ flutter pub add random_string
Source repository

What it does

Provides functions like randomString, randomNumeric, randomAlpha, and randomAlphaNumeric to create random data. Allows custom random providers, including secure ones, and includes a randomBetween utility with range validation.

AI-written summary of version 2.3.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need quick, non‑cryptographic random strings for tests or mock data
  • You want to customize the random source, e.g., using Random.secure

Skip it when

  • Cryptographic security is required
  • You need locale‑aware or Unicode strings

Strengths

  • Zero dependencies
  • Simple API
  • Customizable random provider

Weaknesses

  • Not suitable for security‑critical use
  • Limited to ASCII characters

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:random_string/random_string.dart';

void main() {
  print(randomString(10)); // e.g., aZ9~kL2pQ
  print(randomNumeric(4)); // e.g., 3259
  print(randomAlpha(5)); // e.g., aRztC
}

Alternatives

Packages that do the same job and could replace random_string.

Works with

Packages commonly used together with random_string: ones it builds on, ones built on it, and its own family.