generators library

Sub-path import for generators only.

import 'package:hegeltest/generators.dart';

Classes

Generator<T>

Functions

bigIntegers({BigInt? min, BigInt? max}) → Generator<BigInt>
Generates random BigInt values.
booleans({double p = 0.5}) → Generator<bool>
Generates random boolean values.
bytes({int minSize = 0, int maxSize = 100}) → Generator<Uint8List>
Generates a Uint8List of random bytes.
dates({DateTime? min, DateTime? max}) → Generator<DateTime>
Generates DateTime values containing only a date component.
dateTimes({DateTime? min, DateTime? max}) → Generator<DateTime>
Generates full DateTime values with both date and time.
deferred<T>(Generator<T> definition()) → Generator<T>
Returns a generator whose definition is evaluated lazily on first use, enabling self-referential and mutually recursive generator graphs.
domains({int maxLength = 255}) → Generator<String>
Generates domain names.
doubles({double min = double.negativeInfinity, double max = double.infinity, bool allowNan = true, bool allowInfinity = true, bool excludeMin = false, bool excludeMax = false, double smallestNonzeroMagnitude = 5e-324}) → Generator<double>
Generates random double-precision floating-point numbers.
durations({Duration? min, Duration? max}) → Generator<Duration>
Generates Duration values between min and max (inclusive).
emails() → Generator<String>
Generates valid-looking email addresses.
frequency<T>(List<(int, Generator<T>)> weighted) → Generator<T>
Selects a generator based on provided probability weights.
fromRegex(String pattern, {bool fullmatch = true}) → Generator<String>
Generates strings that match a given regular expression pattern.
integers({int min = -9223372036854775808, int max = 9223372036854775807}) → Generator<int>
Generates random integers.
ipv4Addresses() → Generator<InternetAddress>
Generates IPv4 InternetAddress values.
ipv6Addresses() → Generator<InternetAddress>
Generates IPv6 InternetAddress values.
lists<T>(Generator<T> elements, {int minSize = 0, int maxSize = 9223372036854775807}) → Generator<List<T>>
Generates lists of elements from the provided generator.
maps<K, V>(Generator<K> keys, Generator<V> values, {int minSize = 0, int maxSize = 9223372036854775807}) → Generator<Map<K, V>>
Generates maps with unique keys and corresponding values.
nullable<T>(Generator<T> gen, {double nullProbability = 0.5}) → Generator<T?>
Wraps a generator to occasionally produce null.
oneOf<T>(List<Generator<T>> gens) → Generator<T>
Picks one of the provided generators uniformly at random.
oneOfWeighted<T>(List<(int, Generator<T>)> weighted) → Generator<T>
Selects a generator based on provided probability weights.
recursive<T>(Generator<T> base, Generator<T> extend(Generator<T> children), {int maxDepth = _defaultMaxDepth, int maxLeaves = _defaultMaxLeaves}) → Generator<T>
Generates recursively structured values such as trees, ASTs, or JSON documents whose leaves come from base.
sampled<T>(List<T> values) → Generator<T>
Picks a value randomly from a fixed list of values.
sampledWeighted<T>(List<(int, T)> weighted) → Generator<T>
Picks a value randomly from a list of weighted values.
sets<T>(Generator<T> elements, {int minSize = 0, int maxSize = 9223372036854775807}) → Generator<Set<T>>
Generates sets of unique elements from the provided generator.
text({int minSize = 0, int maxSize = 100, int minCodepoint = 0, int maxCodepoint = 0x10FFFF}) → Generator<String>
Generates random text strings.
times({TimeRecord? min, TimeRecord? max}) → Generator<TimeRecord>
Generates TimeRecord values containing only a time component.
tuples2<A, B>(Generator<A> a, Generator<B> b) → Generator<(A, B)>
Generates 2-tuples (pairs) of independent values.
tuples3<A, B, C>(Generator<A> a, Generator<B> b, Generator<C> c) → Generator<(A, B, C)>
Generates 3-tuples of independent values.
tuples4<A, B, C, D>(Generator<A> a, Generator<B> b, Generator<C> c, Generator<D> d) → Generator<(A, B, C, D)>
Generates 4-tuples of independent values.
urls() → Generator<String>
Generates valid-looking URLs.
uuids() → Generator<String>
Generates v4 UUIDs.