playSoundChoice<T> method
Implementation
Future<T> playSoundChoice<T>(String path, String methodChanel) async {
var result = '';
var value = 0.0;
switch (methodChanel) {
case 'drag':
try {
value = await _channelDrag
.invokeMethod<double>(path)
.then<double>((double? value) => value ?? 0.0);
} on PlatformException catch (e) {
debugPrint(e.code);
}
return value as T;
case 'trim':
try {
value = await _channelTrim
.invokeMethod<double>(path)
.then<double>((double? value) => value ?? 0.0);
} on PlatformException catch (e) {
debugPrint(e.code);
}
return value as T;
case 'music':
try {
await _channel.invokeMethod(path);
} on PlatformException catch (e) {
debugPrint(e.code);
}
return result as T;
case 'record':
try {
await _channelRecord.invokeMethod(path);
} on PlatformException catch (e) {
debugPrint(e.code);
}
return result as T;
}
return result as T;
}