asRef<T extends ZenController> method
Create a typed reference to this controller instance
Implementation
ControllerRef<T> asRef<T extends ZenController>({
String? tag,
bool isPermanent = false,
ZenScope? scope,
}) {
if (this is T) {
if (scope != null) {
scope.put<T>(this as T, tag: tag, isPermanent: isPermanent);
} else {
Zen.put<T>(this as T, tag: tag, isPermanent: isPermanent);
}
return ControllerRef<T>(tag: tag, scope: scope);
}
throw Exception('Controller is not of type $T');
}