registerOnConnectFinished static method
void
registerOnConnectFinished(
- void callback(
- GemError connection,
- NetworkType networkType,
- ProxyDetails? httpsProxyInfo,
- ProxyDetails? httpProxyInfo,
Register a callback invoked when the connection attempt finished.
This callback receives detailed connection information such as the result code, the detected NetworkType and optional proxy details. Currently this registration is supported only on Android and will throw when called on other platforms.
Parameters
callback: Function called when a connection attempt finishes. The callback is called with the following arguments:- connection — a GemError describing the connection result (success or error).
- networkType — the detected NetworkType.
- httpsProxyInfo — optional HTTPS ProxyDetails when available.
- httpProxyInfo — optional HTTP ProxyDetails when available.
Throws
- PlatformException when the platform does not support this callback (non-Android).
Implementation
static void registerOnConnectFinished(
void Function(
GemError connection,
NetworkType networkType,
ProxyDetails? httpsProxyInfo,
ProxyDetails? httpProxyInfo,
)
callback,
) {
if (!Platform.isAndroid) {
throw PlatformException(
code: 'PlatformNotSupported',
message: 'The platform is not Android.',
);
}
_onConnectFinished = callback;
}