Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 颤振获取页面中的导航器参数_Dart_Flutter - Fatal编程技术网

Dart 颤振获取页面中的导航器参数

Dart 颤振获取页面中的导航器参数,dart,flutter,Dart,Flutter,我有两页A页和B页。我浏览表单A页->B页,编辑一些数据,或切换设置。现在我想导航表单B->A页,以及在navigator pop方法上发送的参数。现在我的问题是: 如何访问A页中的这些参数 Navigator.pop(context, this.selectedEquipmentId); 事实上,当你结束PageA时,你必须归还一些东西。我给你举了一个例子,用一个弹出窗口来选择我最近做的一个地址,如果这不是一个弹出窗口的话,效果完全一样 Future<PlacesDetailsRes

我有两页A页和B页。我浏览表单A页->B页,编辑一些数据,或切换设置。现在我想导航表单B->A页,以及在navigator pop方法上发送的参数。现在我的问题是:

如何访问A页中的这些参数

 Navigator.pop(context, this.selectedEquipmentId);

事实上,当你结束PageA时,你必须归还一些东西。我给你举了一个例子,用一个弹出窗口来选择我最近做的一个地址,如果这不是一个弹出窗口的话,效果完全一样

Future<PlacesDetailsResponse> showAdressPicker({@required BuildContext context}) async {
  assert(context != null);
  return await showDialog<PlacesDetailsResponse>(
    context: context,
    builder: (BuildContext context) => AdressPickerComponent(),
  );
}
只需在结果中放入您想要的任何内容,(在这里我创建了一个名为PlacesDetailsResponse的类,使用您的或只是Int,String…)。 现在在pageA中,当你称之为

showAdressPicker(context: context).then((PlacesDetailsResponse value) {
  //do whatever you want here
  // this fires when PageB call previous to PageA
});

查看
Navigator#push()
method returns我尝试了此方法,但不起作用:this.selectedEquipmentId=Navigator.push(上下文,MaterialPageRoute(builder:(BuildContext context){return ExercisesFilterPage(设备:设备,);},),)作为字符串;因为它是
showAdressPicker(context: context).then((PlacesDetailsResponse value) {
  //do whatever you want here
  // this fires when PageB call previous to PageA
});