Flutter:在屏幕之间传递多个数据

Jun*_*say 5 flutter

我是颤振新手。我正在尝试将多个数据发送到另一个屏幕:

// screen1.dart
..
Expanded(
  child: RaisedButton(
    onPressed: () {
      Navigator.push(context,
        MaterialPageRoute(
          builder: (context) => new Screen2(name: thing.name, email: thing.email, address: thing.address, etc..),
        ),
      );
    },
  ),
),
..


// screen2.dart

class Screen2 extends StatefulWidget{
  Screen2({this.name}, {this.email}, {this.address}, etc..);
  final String name;
  final String email;
  final String address;
  // etc
  @override
  State<StatefulWidget> createState() { return new Screen2State();}
}

class Screen2State extends State<Screen2> {
  Widget build(BuildContext context) {
    return new WillPopScope(
      ..
      child: Scaffold(
        ..
        new Row(
          children: <Widget>[
            new Text(widget.name),
            new Text(widget.email),
            new Text(widget.address),
            etc..
          ],
        ),
      )
    )
}
Run Code Online (Sandbox Code Playgroud)

但我收到错误:A non-null String must be provided to a Text widget.

数据从 TextEditingController 传输。仅传输 1 个数据时有效,但传输 2 个或更多数据时失败。

在屏幕之间发送多个数据的正确方法是什么?

小智 2

考虑通过路由参数传递参数。请参阅此处的官方文档https://flutter.dev/docs/cookbook/navigation/navigate-with-arguments