Last active
July 28, 2020 14:48
-
-
Save kumar-aakash86/45bff399d3581644f5f9d4d6886bf662 to your computer and use it in GitHub Desktop.
Dart Generate Function - Custom Class
This file contains hidden or 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
| void main() { | |
| List<Product> numberList = List<Product>.generate(10, (i) => Product("Product $i")); | |
| numberList.forEach(print); | |
| } | |
| class Product{ | |
| String title; | |
| Product(this.title); | |
| toString() => this.title; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment