makeRequest static method
Performs the USSD request and returns the response
Implementation
static Future<String> makeRequest(
int subscriptionId,
String code, [
Duration timeout = const Duration(seconds: 10),
]) async {
final String response = await _channel
.invokeMethod(
"makeRequest",
{"subscriptionId": subscriptionId, "code": code},
)
.timeout(timeout)
.catchError((e) {
// TODO: Move timeout handling to Android side once Java 9 is used
// and `CompletableFuture.timeout` is available
if (e is TimeoutException) {
throw PlatformException(
code: "ussd_plugin_ussd_execution_timeout", message: e.message);
}
throw e;
});
return response;
}