fromString static method
Initializer from string
Implementation
static CustomProxy? fromString({required String proxy}) {
// Check if valid
if (proxy.isEmpty) {
assert(
false, "Proxy string passed to CustomProxy.fromString() is invalid.");
return null;
}
// Build and return
final proxyParts = proxy.split(":");
final _ipAddress = proxyParts[0];
final _port = proxyParts.length > 0 ? int.tryParse(proxyParts[1]) : null;
return CustomProxy(
ipAddress: _ipAddress,
port: _port,
);
}