loop method
loop
{int|String} times->
number n - loop n times
'inf' - loop infinitely often
'no' - switch loop to off
if times is not set, this method will toggle the loop state, if any looping is set, either 'inf' or a fixed number it will be switched off
Implementation
Future<void> loop(times) async {
// if times was set, use it. Times can be any number > 0, 'inf' and 'no'
if (times != null) {
return setProperty('loop', times);
}
// if times was not set, net loop toggle the mute property
else {
// get the loop status
// if any loop status was set, either 'inf' or a fixed number, switch loop to off
// if no loop status was set, switch it on to 'inf'
var loop_status = await getProperty('loop');
return setProperty('loop', loop_status == null ? 'inf' : 'no');
}
}