listOfStates method
Implementation
Future<RemoteResponse<Map>> listOfStates({
required String countryCode
}) async {
try {
Dio dio = getDio(null);
final body = {
"country": countryCode.toUpperCase(),
};
final response = await dio.get<Map<String, dynamic>>(
listOfStatesPath,
queryParameters: body,
);
final Map<String, dynamic>? data = response.data;
log('DATA: $data');
if (response.statusCode == 200) {
final Map<String, dynamic> payload =
data?['payload'] as Map<String, dynamic>;
return RemoteResponse.withNewData(payload['results']);
} else {
throw EkycApiException.fromJson(response.data!);
}
} on DioError catch (e) {
return handleDioError(e);
}
}