📅  最后修改于: 2022-03-11 14:58:49.991000             🧑  作者: Mango
Future> getFileLines() async {
final data = await rootBundle.load('assets/bot.txt');
final directory = (await getTemporaryDirectory()).path;
final file = await writeToFile(data, '$directory/bot.txt');
return await file.readAsLines();
}
Future writeToFile(ByteData data, String path) {
return File(path).writeAsBytes(data.buffer.asUint8List(
data.offsetInBytes,
data.lengthInBytes,
));
}