optimizeForProduction method

void optimizeForProduction({
  1. bool force = false,
})

Runs several optimizations, if angelEnv.isProduction is true.

  • Preprocesses all dependency injection, and eliminates the burden of reflecting handlers at run-time.
  • flattens the route tree into a linear one.

You may force the optimization to run, if you are not running in production.

Implementation

void optimizeForProduction({bool force = false}) {
  if (environment.isProduction || force == true) {
    _flattened ??= flatten(this);
    logger.info('Angel is running in production mode.');
  }
}