register<T extends ZenController> method

T register<T extends ZenController>({
  1. String? tag,
  2. bool isPermanent = false,
  3. ZenScope? scope,
})

Register this controller in the DI container

Implementation

T register<T extends ZenController>({
  String? tag,
  bool isPermanent = false,
  ZenScope? scope,
}) {
  if (this is T) {
    if (scope != null) {
      return scope.put<T>(this as T, tag: tag, isPermanent: isPermanent);
    } else {
      return Zen.put<T>(this as T, tag: tag, isPermanent: isPermanent);
    }
  }
  throw Exception('Controller is not of type $T');
}