Controller constructor
const
Controller({
- bool autoDisposeWhenUnreferenced = true,
Annotation for creating queries for controllers.
You can define a query to retrieve the controller at static const query = _$(class name)ControllerQuery()
.
Used for classes inheriting from ChangeNotifier
.
If autoDisposeWhenUnreferenced is set to true
, it will automatically dispose of Controller when it is no longer referenced by any widget.
コントローラー用のクエリを作成するためのアノテーション。
static const query = _$(クラス名)ControllerQuery()
にコントローラーを取得するためのクエリを定義できます。
ChangeNotifier
を継承したクラスに対して利用します。
autoDisposeWhenUnreferencedをtrue
にした場合、Controllerがどのウィジェットにも参照されなくなったときに自動的に破棄します。
@controller
@listenables
class UserController extends ChangeNotifier {
UserController();
static const query = _$UserControllerQuery();
}
Implementation
const Controller({
this.autoDisposeWhenUnreferenced = true,
});