withCallLimit<T> static method

Future<T> withCallLimit<T>(
  1. Duration? limit,
  2. Future<T> body(), {
  3. Duration evaluateLimit()?,
})

Runs body with every cheap VM call held to limit and every expression evaluate held to evaluateLimit (10 s when null, since compiling is legitimate); null limit lifts an outer one, and a tree read gets twice as long.

Implementation

static Future<T> withCallLimit<T>(Duration? limit, Future<T> Function() body, {Duration Function()? evaluateLimit}) =>
    runZoned(body, zoneValues: {_callLimitKey: limit, _evalLimitKey: evaluateLimit});