fetchSurvey function
Future<Map>
fetchSurvey(
- dynamic token,
- dynamic domain
)
Implementation
Future<Map<dynamic, dynamic>> fetchSurvey(token, domain) async {
// if(token.startsWith('ntt') || token.startsWith('NTT')){
// throw Exception('Un Supported Survey Type');
// }
// check url before prod
var url = 'https://${domain}/api/internal/sdk/get-survey/${token}';
final response = await http.get(Uri.parse(url));
if (response.statusCode == 200) {
final parsedJson = jsonDecode(response.body);
return parsedJson;
} else {
print("response failed");
throw Exception('Some Error Happened When Loading the Survey');
}
}