Skip to content

Instantly share code, notes, and snippets.

@kumar-aakash86
Last active July 28, 2020 14:48
Show Gist options
  • Select an option

  • Save kumar-aakash86/45bff399d3581644f5f9d4d6886bf662 to your computer and use it in GitHub Desktop.

Select an option

Save kumar-aakash86/45bff399d3581644f5f9d4d6886bf662 to your computer and use it in GitHub Desktop.
Dart Generate Function - Custom Class
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