getShortenedUrl function
Implementation
Future<String> getShortenedUrl(String url) async {
try {
final response = await http.post(
Uri.parse('$BACKEND_BASE_URL/api/sdk/shortener'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode({'fullUrl': url}));
final res = json.decode(response.body);
final shortenedVerificationUrl = res['result']['shortUrl'];
return shortenedVerificationUrl;
} catch (err) {
return url;
}
}