getWarningsByProductId method

Future<List<Warning>> getWarningsByProductId(
  1. String id
)

Gets all the warnings of the product that matches an id.

Implementation

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

  ClientException.checkIsSuccessStatusCode(response);

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