setAudioFile method

  1. @override
Future<void> setAudioFile({
  1. String mainPath = '',
  2. String accentedPath = '',
})
override

Implementation

@override
Future<void> setAudioFile({
  String mainPath = '',
  String accentedPath = '',
}) async {
  Uint8List mainFileBytes = Uint8List.fromList([]);
  Uint8List accentedFileBytes = Uint8List.fromList([]);
  if (mainPath != '') {
    mainFileBytes = await loadFileBytes(mainPath);
  }
  if (accentedPath != '') {
    accentedFileBytes = await loadFileBytes(accentedPath);
  }
  if (mainFileBytes.isEmpty && accentedFileBytes.isEmpty) {
    return;
  }
  try {
    await methodChannel.invokeMethod<void>('setAudioFile', {
      'mainFileBytes': mainFileBytes,
      'accentedFileBytes': accentedFileBytes,
    });
  } catch (e) {
    if (kDebugMode) {
      print(e);
    }
  }
}