getProductsByMealTypeId method

Future<List<Product>> getProductsByMealTypeId(
  1. String id
)

Gets all the products of the meal type that matches an id.

Implementation

Future<List<Product>> getProductsByMealTypeId(String id) async {
  final response = await _context.client.get(
    Uri.https(authority, '$path/mealtypes/$id/products'),
  );

  ClientException.checkIsSuccessStatusCode(response);

  return (json.decode(response.body) as List)
      .map((e) => Product.fromJson(e))
      .toList();
}