fix: Make key backup work in web

This commit is contained in:
Sorunome 2020-10-14 12:13:57 +02:00
parent eabef15790
commit 01bb3f5b50
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
1 changed files with 7 additions and 1 deletions

View File

@ -21,7 +21,13 @@ import 'dart:async';
Future<T> runInBackground<T, U>(
FutureOr<T> Function(U arg) function, U arg) async {
final isolate = await IsolateRunner.spawn();
IsolateRunner isolate;
try {
isolate = await IsolateRunner.spawn();
} on UnsupportedError {
// web does not support isolates (yet), so we fall back to calling the method directly
return await function(arg);
}
try {
return await isolate.run(function, arg);
} finally {