Skip to content

Instantly share code, notes, and snippets.

@Deleplace
Created March 22, 2022 20:59
Show Gist options
  • Save Deleplace/0f1b36e608f219f0a5ea9c88c1d39d3d to your computer and use it in GitHub Desktop.
Save Deleplace/0f1b36e608f219f0a5ea9c88c1d39d3d to your computer and use it in GitHub Desktop.
Replace value in list
void main() {
var x = [
"a",
"",
"foo",
"bar",
"foo",
];
print("Before:\t x is ${x}");
x = x.map((e) => e == 'foo' ? 'bar' : e).toList();
print("After:\t x is ${x}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment