setupAdbPortForward static method
- int port = 9090,
Try to run ADB forward from the host machine. Call this static method from your development scripts or IDE.
Implementation
static Future<bool> setupAdbPortForward({int port = 9090}) async {
if (kIsWeb) return false;
final adbPath = await _findAdb();
if (adbPath == null) {
print('Neuron: ADB not found in PATH or common locations');
return false;
}
try {
final result = await Process.run(
adbPath,
['forward', 'tcp:$port', 'tcp:$port'],
);
if (result.exitCode == 0) {
print('');
print('╔════════════════════════════════════════════════════════════╗');
print(
'║ 🚀 Neuron DevTools Server started on port $port ║');
print('╠════════════════════════════════════════════════════════════╣');
print('║ ✅ ADB port forward established automatically! ║');
print('║ ║');
print(
'║ Connect dashboard to: ws://127.0.0.1:$port ║');
print('╚════════════════════════════════════════════════════════════╝');
print('');
return true;
} else {
print('Neuron: ADB forward failed: ${result.stderr}');
return false;
}
} catch (e) {
print('Neuron: Failed to run ADB: $e');
return false;
}
}