run<R extends Object?> function

R run<R extends Object?>(
  1. R block()
)

Executes a code block and returns its result.

This is a utility for wrapping computation in a function scope. Primarily useful as a base for scope manipulation or when you need to control the execution context of a block of code.

Example:

final result = run(() {
  print('Doing computation...');
  return 49;
});

Implementation

R run<R extends Object?>(R Function() block) => block();