registerOnConnectionFailed static method

void registerOnConnectionFailed(
  1. void callback(
    1. GemError reason
    )
)

Register a callback invoked when a connection attempt fails.

The provided callback receives a GemError describing the failure reason. This registration is currently available only on Android.

Parameters

  • callback: Function called with a GemError describing the failure reason.

Throws

Implementation

static void registerOnConnectionFailed(
  void Function(GemError reason) callback,
) {
  if (!Platform.isAndroid) {
    throw PlatformException(
      code: 'PlatformNotSupported',
      message: 'The platform is not Android.',
    );
  }
  _onConnectionFailed = callback;
}