easy_isolate_mixin 1.0.1 easy_isolate_mixin: ^1.0.1 copied to clipboard
A simplified mixin for launching Dart isolates in Flutter, seamlessly working with Flutter plugins
example/easy_isolate_mixin_example.dart
import 'package:easy_isolate_mixin/easy_isolate_mixin.dart';
class Service with IsolateHelperMixin {
Future<List<int>> performExpensiveWork() =>
loadWithIsolate(() => _expensiveWork());
}
void main() {
final service = Service();
service.performExpensiveWork();
}
Future<List<int>> _expensiveWork() async {
List<int> result = [];
for (int i = 0; i < 1000000; i++) {
result.add(i);
}
return result;
}