fetchProvidersByAppId function
Implementation
Future<List<ProviderV2>> fetchProvidersByAppId(
String appId, String providerId) async {
try {
final response = await http.get(Uri.parse(
'${Constants.GET_PROVIDERS_BY_ID_API}/$appId/provider/$providerId'));
final res = json.decode(response.body);
List<dynamic> rawProviders = res['providers']['httpProvider'];
final providers = rawProviders.map((p) => ProviderV2.fromJson(p)).toList();
return providers;
} catch (err) {
logger.e(err);
throw Exception('Error fetching provider with AppId: $appId');
}
}