switchOnUSBTether method
Enables USB tethering on the device.
This method attempts to turn on USB tethering by invoking a platform-specific call.
Returns a Future containing a bool indicating whether USB tethering was successfully enabled.
Returns false if an error occurs while enabling USB tethering.
Implementation
Future<bool> switchOnUSBTether() async {
try {
final bool result = await androidPlatform.invokeMethod('setUsbTethering', {'status': true});
return result; // Return the result of the tethering operation.
} on PlatformException catch (e) {
debugPrint("Failed to enable tethering: '${e.message}'.");
return false; // Return false in case of an error.
}
}