Last active
January 10, 2021 14:31
-
-
Save tareq3/a945406c94627450d696ead1a7db7895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
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