可以在php url中使用flutter变量

问题描述 投票:0回答:1

我想在PHP URL中使用flutter变量的值。我可以做什么来传递变量的值。

我已经尝试传递值或者可以在web视图中说出一个id,但是它打印字符串而不是变量的值。

`

String url = "http://10.0.2.2/pre_beta_02/dummy.php?therapist_id=value";

class NextPage extends StatefulWidget{
  //List list;
  String value;
  //NextPage({this.value});

  NextPage({Key key,this.value}):super (key: key);

  @override
  _Nextpagestate createState() => new _Nextpagestate();

}

class _Nextpagestate extends State<NextPage>{
  @override
  Widget build(BuildContext context) {

    return WebviewScaffold(
      appBar: new AppBar(
        title: new Text('${widget.value}'),
      ),
      url: url,


    );
  }


}

`

我希望输出为“值= 5”但实际输出为“值”

android flutter flutter-dependencies
1个回答
0
投票

这应该这样做:

return WebviewScaffold(
  appBar: new AppBar(
    title: new Text('${widget.value}'),
  ),
  url: "http://10.0.2.2/pre_beta_02/dummy.php?therapist_id=${widget.value}",
);
© www.soinside.com 2019 - 2024. All rights reserved.