setSystemVolume method
Sets the system media volume to percent ([0, 100]). Returns whether
the platform applied it.
将系统媒体音量设为 percent([0, 100])。返回平台是否应用了该值。
percent: target volume in[0, 100]/ 目标音量,取值[0, 100]
Example / 示例:
await MovaPlatform.instance.setSystemVolume(50);
Implementation
@override
Future<bool> setSystemVolume(double percent) async {
try {
final ok = await methodChannel.invokeMethod<bool>(
'setSystemVolume',
{'percent': percent},
);
return ok ?? false;
} on PlatformException {
return false;
} on MissingPluginException {
return false;
}
}