run<R> method

Future<R> run<R>(
  1. FutureOr<R> body(), {
  2. String scope = 'command',
})

Runs body inside a scope named scope with this application's container active (commands, tests, scripts).

Implementation

Future<R> run<R>(
  FutureOr<R> Function() body, {
  String scope = 'command',
}) async {
  await boot();
  return container.runScoped<R>(scope, (_) => body());
}