withApp method

Future<int> withApp(
  1. FutureOr<int> body(
    1. Application app
    )
)
inherited

Boots the application, runs body inside a command scope and shuts the application down afterwards.

Implementation

Future<int> withApp(FutureOr<int> Function(Application app) body) async {
  final app = createApp();
  try {
    await app.boot();
    return await app.run<int>(() => body(app));
  } finally {
    await app.shutdown();
  }
}