startAction method
void
startAction( - dynamic context,
- dynamic ref
)
Implementation
void startAction(BuildContext context, WidgetRef ref) async {
EasyLoading.show(status: L10n.of(context).encryptionBackupEnabling);
String secret;
try {
final manager = ref.read(backupManagerProvider);
secret = await manager.enable();
} catch (e, s) {
_log.severe('Failed to enable backup', e, s);
if (!context.mounted) {
EasyLoading.dismiss();
return;
}
EasyLoading.showError(
L10n.of(context).encryptionBackupEnablingFailed(e),
duration: const Duration(seconds: 5),
);
return;
}
EasyLoading.dismiss();
if (context.mounted) {
showRecoveryKeyDialog(context, ref, secret);
}
}