generateProducts static method

List<FakeProduct> generateProducts(
  1. int count
)

Implementation

static List<FakeProduct> generateProducts(int count) {
  return List.generate(count, (index) {
    return FakeProduct(
      id: 'P${index + 1}',
      name: Fake.productNames[index % Fake.productNames.length],
      description:
          Fake.productDescriptions[index % Fake.productDescriptions.length],
      price: (index + 1) * 20.0,
      imageUrl: 'https://example.com/images/product${index + 1}.png',
      category: Fake.categories[index % Fake.categories.length],
      comments: Fake.commentsList[index % Fake.commentsList.length],
    );
  });
}