Skip to content

Instantly share code, notes, and snippets.

@tareq3
Last active January 10, 2021 14:31
Show Gist options
  • Save tareq3/a945406c94627450d696ead1a7db7895 to your computer and use it in GitHub Desktop.
Save tareq3/a945406c94627450d696ead1a7db7895 to your computer and use it in GitHub Desktop.
```
main() {
List<Test> first = [Test(1,"temp"), Test(2,"temp")];
first.where((e)=> e.no==2).map((e){
e.no= 5;
}).toList();
first.forEach((e)=>
print(e.toJson())
);
}
class Test{
int no;
final String name; //here final plays important role, if variable final it can't be refatored
Test( this.no, this.name);
//only for print
Object toJson() {
return "${no} : $name";
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment