async warning fixes

This commit is contained in:
julian 2022-09-15 13:47:06 -06:00
parent 3820a06eed
commit 349646c05b

View file

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
@ -396,46 +397,46 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
passwordRepeatController.text; passwordRepeatController.text;
if (pathToSave.isEmpty) { if (pathToSave.isEmpty) {
showFloatingFlushBar( unawaited(showFloatingFlushBar(
type: FlushBarType.warning, type: FlushBarType.warning,
message: "Directory not chosen", message: "Directory not chosen",
context: context, context: context,
); ));
return; return;
} }
if (!(await Directory(pathToSave).exists())) { if (!(await Directory(pathToSave).exists())) {
showFloatingFlushBar( unawaited(showFloatingFlushBar(
type: FlushBarType.warning, type: FlushBarType.warning,
message: "Directory does not exist", message: "Directory does not exist",
context: context, context: context,
); ));
return; return;
} }
if (passphrase.isEmpty) { if (passphrase.isEmpty) {
showFloatingFlushBar( unawaited(showFloatingFlushBar(
type: FlushBarType.warning, type: FlushBarType.warning,
message: "A passphrase is required", message: "A passphrase is required",
context: context, context: context,
); ));
return; return;
} }
if (passphrase != repeatPassphrase) { if (passphrase != repeatPassphrase) {
showFloatingFlushBar( unawaited(showFloatingFlushBar(
type: FlushBarType.warning, type: FlushBarType.warning,
message: "Passphrase does not match", message: "Passphrase does not match",
context: context, context: context,
); ));
return; return;
} }
showDialog<dynamic>( unawaited(showDialog<dynamic>(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (_) => const StackDialog( builder: (_) => const StackDialog(
title: "Encrypting backup", title: "Encrypting backup",
message: "This shouldn't take long", message: "This shouldn't take long",
), ),
); ));
// make sure the dialog is able to be displayed for at least 1 second // make sure the dialog is able to be displayed for at least 1 second
await Future<void>.delayed( await Future<void>.delayed(
const Duration(seconds: 1)); const Duration(seconds: 1));