fix: resize images in a separate isolate

This commit is contained in:
Sorunome 2020-10-06 18:22:50 +02:00
commit a113f99135
6 changed files with 131 additions and 113 deletions

View file

@ -0,0 +1,12 @@
import 'package:isolate/isolate.dart';
import 'dart:async';
Future<T> runInBackground<T, U>(
FutureOr<T> Function(U arg) function, U arg) async {
final isolate = await IsolateRunner.spawn();
try {
return await isolate.run(function, arg);
} finally {
await isolate.close();
}
}