Improved error handling for the app
Description
Improving error handling inside the app. As of now, all APIs are expecting positive responses but there are several situations in which it might not work. Also, I am covering small cases where the app crashes. Therefore, the PR is going to have a major code change so I thought to create a WIP PR and start working.
Fixes: #63
@harchani-ritik I have added more checks (showing toasts to users) and try-catch statements with debug prints. Also, I have added this small chin to show if the app is not able to fetch torrentsList from the rtorrent server.

Also, I would suggest trying out the app changes before merging.
Hi @tusharojha, a big red label looks a bit odd in the app theme. Maybe you can change it to have a background colour of grey[100] and text colour red. Also add an error icon leading the text.
Now the changes in lib/api/api_requests.dart file has too many checks for the status code 200 from the response and debug print. So instead of checking it manually every-time you can create functions similar to
bool isConnectedToTorrentServer (dynamic response) {
if (response.statusCode == 200) {
return true;
}
return false;
}
void showNetworkErrorResponse (dynamic response, String value) {
Fluttertoast.showToast(msg: 'Unable to $value. Please check your network.');
debugPrint('Error in $value api: [${response.statusCode}] ${response.body}');
}
and optimise repetition of code. Also try to think about other status codes that the torrent server may respond. #64
The project has been updated extensively in the last 2 years (check wiki for more info). The default branch is now the "main" branch. All issues and pull requests for previous versions are being removed.