ControllerGroup constructor
const
ControllerGroup({
- bool autoDisposeWhenUnreferenced = true,
Annotation to create a query for a group of controllers.
You can define a query to retrieve the controller at static const query = _$(class name)ControllerGroupQuery()
.
Multiple ChangeNotifier
s can be grouped together in katana_listenables
and used as a controller group.
If autoDisposeWhenUnreferenced is set to true
, ControllerGroup will be automatically disposed of when it is no longer referenced by any widget.
コントローラーグループ用のクエリを作成するためのアノテーション。
static const query = _$(クラス名)ControllerGroupQuery()
にコントローラーを取得するためのクエリを定義できます。
katana_listenables
で複数のChangeNotifier
をまとめた上でコントローラーグループとして利用することが可能です。
autoDisposeWhenUnreferencedをtrue
にした場合、ControllerGroupがどのウィジェットにも参照されなくなったときに自動的に破棄します。
@listenables
@controllerGroup
class PageControllerGroup with _$PageControllerGroup, ChangeNotifier {
factory ${className}ControllerGroup({
TextEditingController? textEditingController,
FocusNode? focusNode,
}) = _PageControllerGroup;
PageControllerGroup._();
static const query = _$PageControllerGroupQuery();
}
Implementation
const ControllerGroup({
this.autoDisposeWhenUnreferenced = true,
});