Skip to content

Instantly share code, notes, and snippets.

@mhmadip
Created April 6, 2022 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhmadip/72e9360eb080c523fa1bfc327789c9f5 to your computer and use it in GitHub Desktop.
Save mhmadip/72e9360eb080c523fa1bfc327789c9f5 to your computer and use it in GitHub Desktop.
Creating Objects using Loop and store them in a list
class Object {
int id = 0;
String name='abc';
Object(this.id);
@override
String toString()=> id.toString() + name;
}
void main() {
var list =<Object> [];
for (var x = 1; x < 10; x++) {
list.add(Object(x)) ;
}
print(list);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment