DoxProvider class abstract

A provider sets up a part of the app when it starts, eg. the database, Redis or the auth guards. Dox finds every class that extends it (with dox_builder) and runs it in every isolate.

class RedisProvider extends DoxProvider {
  late RedisConnection redis;

  @override
  Future<void> setup() async {
    redis = await RedisConnection.open();
  }

  @override
  Future<void> shutdown() async {
    await redis.close();
  }
}

Constructors

DoxProvider()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setup() → FutureOr<void>
Runs once in every isolate when the app starts, before the routes are registered.
shutdown() → FutureOr<void>
Runs once in every isolate when the server stops, eg. to close database or Redis connections. It runs after the open requests are done (on SIGTERM, SIGINT or Dox().stop()). Optional.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited