writeFileAsString static method
写入文件内容
Implementation
static Future<bool> writeFileAsString(String filePath, String content, {bool catchException = true}) async {
try {
final file = File(filePath);
await file.writeAsString(content);
return true;
} catch (e) {
if (catchException) {
return false;
} else {
rethrow;
}
}
}