chore: address use of then method on awaited future
This commit is contained in:
parent
96d95f528d
commit
595ddf8035
1 changed files with 15 additions and 16 deletions
|
@ -243,23 +243,22 @@ class _InventoryBrowserAppBarState extends State<InventoryBrowserAppBar> {
|
||||||
filename: filename,
|
filename: filename,
|
||||||
updates: Updates.statusAndProgress,
|
updates: Updates.statusAndProgress,
|
||||||
);
|
);
|
||||||
await FileDownloader().enqueue(downloadTask).then((b) {
|
final downloadStatus = await FileDownloader().enqueue(downloadTask);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
if (b) {
|
if (downloadStatus) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text("Downloaded ${record.formattedName.toString()}"),
|
content: Text("Downloaded ${record.formattedName.toString()}"),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text("Failed to download ${record.formattedName.toString()}"),
|
content: Text("Failed to download ${record.formattedName.toString()}"),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
final tempDirectory = await _tempDirectoryFuture;
|
final tempDirectory = await _tempDirectoryFuture;
|
||||||
final file = File(
|
final file = File(
|
||||||
"${tempDirectory.path}/${record.id.split("-")[1]}-${record.formattedName.toString()}${extension(uri)}");
|
"${tempDirectory.path}/${record.id.split("-")[1]}-${record.formattedName.toString()}${extension(uri)}");
|
||||||
|
|
Loading…
Reference in a new issue