getNudgesBottomSheets method

Future<NudgeBottomSheets> getNudgesBottomSheets()

Implementation

Future<NudgeBottomSheets> getNudgesBottomSheets() async {
  var headers = {'authorization': token};
  var request =
      http.Request('GET', Uri.parse('$baseUrl/popups/m/get/user/$nudgeId'));

  request.headers.addAll(headers);

  http.StreamedResponse response = await request.send();

  if (response.statusCode == 200) {
    return NudgeBottomSheets.fromJson(
        json.decode(await response.stream.bytesToString()));
  } else {
    throw Exception('Failed to fetch nudge bottom sheets data');
  }
}