recursive<T> function
Returns an arbitrary that generates values for recursive data structures
using the provided base
and extend
functions.
The extend
function is called with the result of the base
function or
the last extend
invocation, allowing for progressive construction
of complex data structures.
Parameters:
base
: A function that returns an arbitrary used for generating the initial values at the base level.extend
: A function that takes an arbitrary and returns a new arbitrary based on it, used to extend the recursion.maxDepth
: The maximum depth of recursion (default is 5). Increasing this value can significantly increase the time required for data generation.
Implementation
Arbitrary<T> recursive<T>(
Arbitrary<T> Function() base,
Arbitrary<T> Function() Function(Arbitrary<T> Function()) extend, {
int? maxDepth,
}) =>
RecursiveArbitraries.recursive(
base,
extend,
maxDepth: maxDepth,
);