将 list<int> 转换为字符串抖动

Zer*_*ive 1 dart flutter

假设我们有一个整数列表:

List<int> integers=[4, 5];
Run Code Online (Sandbox Code Playgroud)

我想将此列表转换为字符串值,如下所示:

String val="4,5"
Run Code Online (Sandbox Code Playgroud)

我怎样才能在飞镖中做到这一点?

Vir*_*iya 5

您可以使用 join 方法来做到这一点。

print(integers.join(","));
Run Code Online (Sandbox Code Playgroud)