Skip to content

Instantly share code, notes, and snippets.

@jairoFernandez
Last active December 15, 2020 17:41
Show Gist options
  • Save jairoFernandez/2b7b5b05daa7052cb5e1bec54bc4ba26 to your computer and use it in GitHub Desktop.
Save jairoFernandez/2b7b5b05daa7052cb5e1bec54bc4ba26 to your computer and use it in GitHub Desktop.
Creator Functions
createProducts(int quantity) {
final data = [];
for (var i = 0; i < quantity; i++) {
data.add({"id": i, "name": "name $i", "user": rng.nextInt(quantity - 1)});
}
return data;
}
createUsers(int quantity) {
final data = [];
for (var i = 0; i < quantity; i++) {
data.add({"id": i, "user": "User $i"});
}
return data;
}
# Example of user
[
{
"id": 1,
"user": "User 1"
},
{
"id": 20,
"user": "User 20"
}
]
# Example of Product
[
{
"id": 1,
"name": "name 1",
"user": 20
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment