handler method
- @override
override
Must be implemented
Implementation
@override
Future<Response> handler() async {
final camelCountryCodes = _prepareCountryCodes();
if (camelCountryCodes is Response) {
return camelCountryCodes;
}
try {
final listAvailableDistricts =
await dataLinkRepository.getAvailableDistricts(camelCountryCodes);
return Response.ok(
json.encode({'availableDistricts': listAvailableDistricts}),
headers: {'Content-Type': 'application/json'},
);
} catch (e) {
return Response.internalServerError(
body: json.encode({'Error in ListAvailableDistrictsController: $e'}),
);
}
}