addGlobalMiddleware method
Add a global middleware from a package. Call it in the setup() of a
DoxProvider. It runs on every route, before the app's own
globalMiddleware. A second add of the same one is skipped. It takes
the same kinds as globalMiddleware. Use a top-level function or a
const instance, so a restart does not add it twice. The list is
cleared at each start, before the providers run.
Add it from a provider's setup(), which runs on every start.
Anything added before the app starts is cleared.
Implementation
void addGlobalMiddleware(Object middleware) {
GlobalMiddleware.add(middleware);
}