class IsolateManager {
static Future<LoadBalancer> loadBalancer =
LoadBalancer.create(1, IsolateRunner.spawn);
static Future<dynamic> resolve(method, Map<String, dynamic> data) async {
debugPrint("=====>:开始");
final LoadBalancer lb = await loadBalancer;
var res = await lb.run<dynamic, Map<String, dynamic>>(method, data);
return res;
}
}
class IsolateMethods {
static Future<String> entryPoint(Map<String, dynamic> data) async {
debugPrint("=====>:进行");
//todo:耗时运算
debugPrint("=====>:结束");
return "结束${Isolate.current.debugName}==>:$num";
}
static Future<PageEngineModel> PageEngineModelFromJson(
Map<String, dynamic> data) async {
return PageEngineModel.fromJson(data);
}
}