controller top-level constant

Controller const controller

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を継承したクラスに対して利用します。

autoDisposeWhenUnreferencedtrueにした場合、Controllerがどのウィジェットにも参照されなくなったときに自動的に破棄します。

@controller
@listenables
class UserController extends ChangeNotifier {
  UserController();

  static const query = _$UserControllerQuery();
}

Implementation

const controller = Controller();