Add Flutter text to speech demo (#1087)

This commit is contained in:
Fangjun Kuang
2024-07-08 11:23:11 +08:00
committed by GitHub
parent 1fe12c5107
commit e832d356c7
133 changed files with 6686 additions and 143 deletions

View File

@@ -12,11 +12,14 @@ Future<String> copyAssetFile(String src, [String? dst]) async {
dst = basename(src);
}
final target = join(directory.path, dst);
bool exists = await new File(target).exists();
final data = await rootBundle.load(src);
final List<int> bytes =
data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
await File(target).writeAsBytes(bytes);
if (!exists) {
final data = await rootBundle.load(src);
final List<int> bytes =
data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
await File(target).writeAsBytes(bytes);
}
return target;
}