getRandomNumber function
![Chosen by a fair dice roll, guaranteed to be random](https://raw.githubusercontent.com/TheLastGimbus/rollapi_dart/master/images/xkcd_221_random_number.png]
This is simplest possible helper function, taken straight from XKCD 221,
for those who don't want to mess with stateStream and RequestStatus
It either returns a number, or throws an Exception in the process. Simple.
Uses makeRequest under the hood
Implementation
Future<int> getRandomNumber() async {
final req = await makeRequest();
final result = await req.stateStream.last;
if (result.key == RequestState.finished) {
return result.value as int;
} else if (requestErrorStates.contains(result.key)) {
throw result.value;
} else {
throw ApiException('Request failed :( try again');
}
}