pageParam top-level constant

PageParam const pageParam

Annotation to map each widget parameter to a variable in the page root.

Write @ParaPathParam(\"user_id\") as a parameter annotation to link the user_id in the path to the class argument userId as in the example below.

If name is set to Null, the parameter name itself, i.e. userId, is used.

各ウィジェットのパラメーターとページのルートの変数を対応するためのアノテーション。

下記の例のようにパス内のuser_idをクラス引数のuserIdに紐付けるために@ParaPathParam("user_id")をパラメータのアノテーションとして記述します。

nameNullにした場合はパラメーターの名前そのもの、つまりuserIdが利用されます。

@PagePath("/user/:user_id")
class Test extends StatelessWidget {
  const Test({
    @ParaParam("user_id") required String userId,
    super.key
  });

}

Implementation

const pageParam = PageParam();