getDiets method

Future<List<Diet>> getDiets()

Gets all the diets.

Implementation

Future<List<Diet>> getDiets() async {
  final response = await _context.client.get(
    Uri.https(authority, '$path/diets'),
  );

  ClientException.checkIsSuccessStatusCode(response);

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