testSpeed method
Measure connection speed
Implementation
@override
Future<SingBoxSpeedTestResult> testSpeed() async {
try {
final resultMap = await methodChannel.invokeMethod<Map<dynamic, dynamic>>('testSpeed');
if (resultMap != null) {
return SingBoxSpeedTestResult.fromMap(resultMap);
}
return const SingBoxSpeedTestResult(
downloadSpeed: 0,
uploadSpeed: 0,
success: false,
errorMessage: 'Failed to get speed test result',
);
} catch (e) {
debugPrint('Error testing speed: $e');
return SingBoxSpeedTestResult(
downloadSpeed: 0,
uploadSpeed: 0,
success: false,
errorMessage: e.toString(),
);
}
}