PagePath constructor

const PagePath(
  1. String path, {
  2. Object? key,
  3. String? name,
  4. Object? transition,
  5. List<Object> redirect = const [],
  6. Type? implementType,
})

Annotation defining the page.

Specify the path of the page in path as it is.

When redirect is set, it is possible to write reroute settings for only that page.

You can give a name to a page by specifying name, and you can bind an object (including enums, etc.) to a page by specifying key. All of these can be obtained from RouteQuery.

ページを定義するアノテーション。

pathにページのパスをそのまま指定します。

redirectを設定するとそのページのみに対応するリルート設定を記述することが可能です。

nameを指定することでページに名前をつけることができ、keyを指定することでページにオブジェクト(enumなども含む)を紐付けることが可能です。これらはすべてRouteQueryから取得することができます。

@PagePath("/test")
class TestWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Test")),
      body: Center(child: Text("Body")),
    );
  }
}

Implementation

const PagePath(
  this.path, {
  this.key,
  this.name,
  this.transition,
  this.redirect = const [],
  this.implementType,
});