getMealTypesByProductId method

Future<List<MealType>> getMealTypesByProductId(
  1. String id
)

Gets all the meal types of the product that matches an id.

Implementation

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

  ClientException.checkIsSuccessStatusCode(response);

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