ping abstract method

Future<bool> ping({
  1. Duration timeout = const Duration(seconds: 2),
})

Returns true when the database answers a trivial query within timeout, false otherwise — never throws.

Designed for health checks:

app.enableHealthCheck(checks: [
  () async => HealthCheckResult(name: 'database', healthy: await db.ping()),
]);

Implementation

Future<bool> ping({Duration timeout = const Duration(seconds: 2)});