mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
Set flush: true in backup service (#1717)
This should ensure that files are flushed to disk before this function returns. Also, replaced foreach loop with for loop.
This commit is contained in:
parent
dfccedddb2
commit
cc61a25cd1
1 changed files with 6 additions and 6 deletions
|
@ -130,18 +130,18 @@ class BackupService {
|
||||||
final decryptedData = await _decryptV1(data, password, nonce);
|
final decryptedData = await _decryptV1(data, password, nonce);
|
||||||
final zip = ZipDecoder().decodeBytes(decryptedData);
|
final zip = ZipDecoder().decodeBytes(decryptedData);
|
||||||
|
|
||||||
zip.files.forEach((file) {
|
for (var file in zip.files) {
|
||||||
final filename = file.name;
|
final filename = file.name;
|
||||||
|
|
||||||
if (file.isFile) {
|
if (file.isFile) {
|
||||||
final content = file.content as List<int>;
|
final content = file.content as List<int>;
|
||||||
File('${appDir.path}/' + filename)
|
File('${appDir.path}/' + filename)
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsBytesSync(content);
|
..writeAsBytesSync(content, flush: true);
|
||||||
} else {
|
} else {
|
||||||
Directory('${appDir.path}/' + filename)..create(recursive: true);
|
Directory('${appDir.path}/' + filename)..create(recursive: true);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
await _verifyWallets();
|
await _verifyWallets();
|
||||||
await _importKeychainDumpV1(password, nonce: nonce);
|
await _importKeychainDumpV1(password, nonce: nonce);
|
||||||
|
@ -153,18 +153,18 @@ class BackupService {
|
||||||
final decryptedData = await _decryptV2(data, password);
|
final decryptedData = await _decryptV2(data, password);
|
||||||
final zip = ZipDecoder().decodeBytes(decryptedData);
|
final zip = ZipDecoder().decodeBytes(decryptedData);
|
||||||
|
|
||||||
zip.files.forEach((file) {
|
for (var file in zip.files) {
|
||||||
final filename = file.name;
|
final filename = file.name;
|
||||||
|
|
||||||
if (file.isFile) {
|
if (file.isFile) {
|
||||||
final content = file.content as List<int>;
|
final content = file.content as List<int>;
|
||||||
File('${appDir.path}/' + filename)
|
File('${appDir.path}/' + filename)
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsBytesSync(content);
|
..writeAsBytesSync(content, flush: true);
|
||||||
} else {
|
} else {
|
||||||
Directory('${appDir.path}/' + filename)..create(recursive: true);
|
Directory('${appDir.path}/' + filename)..create(recursive: true);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
await _verifyWallets();
|
await _verifyWallets();
|
||||||
await _importKeychainDumpV2(password);
|
await _importKeychainDumpV2(password);
|
||||||
|
|
Loading…
Reference in a new issue