Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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
Flutter 振翅把绳子折成两半_Flutter_Dart - Fatal编程技术网

Flutter 振翅把绳子折成两半

Flutter 振翅把绳子折成两半,flutter,dart,Flutter,Dart,我有这样的数据字符串 53 > 50 Text(s.toString().substring(0, s.toString().indexOf('>')) 我需要在文本小部件中显示,如53和50,带有> 我能证明我是这样做的 53 > 50 Text(s.toString().substring(0, s.toString().indexOf('>')) 它显示出53的价值。现在我无法打印50。我需要在文本窗口小部件中显示50,我如何才能做到这一点呢?如果保

我有这样的数据字符串

53 > 50
  Text(s.toString().substring(0, s.toString().indexOf('>'))
我需要在文本小部件中显示,如53和50,带有>

我能证明我是这样做的

53 > 50
  Text(s.toString().substring(0, s.toString().indexOf('>'))

它显示出53的价值。现在我无法打印50。我需要在文本窗口小部件中显示50,我如何才能做到这一点呢?

如果保证您的srting中始终有3个单词,即,
53
50
,您可以使用
String.split
方法来实现这一点

split
方法基本上将字符串拆分为多个部分,每当字符串达到匹配条件时就将其打断,这是我们传递给
split
方法的参数

String a = "53 > 50";
List<String> parts = a.split(" "); //  ["53", ">", "50"]