isAvailable method
Calls
BillingManager-isServiceAvailable
to check whether the Billing server is available.
Implementation
Future<bool> isAvailable() async {
final String? isAvailableResult =
await channel.invokeMethod<String>('isAvailable');
if (isAvailableResult == null) {
throw PlatformException(
code: 'no_response',
message: 'Failed to get response from platform.',
);
}
final ServiceAvailableAPIResult isAvailable =
ServiceAvailableAPIResult.fromJson(
json.decode(isAvailableResult) as Map<String, dynamic>);
if (isAvailable.status == '100000') {
return true;
} else {
return false;
}
}