isolate_classy 1.0.1 copy "isolate_classy: ^1.0.1" to clipboard
isolate_classy: ^1.0.1 copied to clipboard

It makes very easy and elegant for your asynchronous functions to run on isolate.

It makes very easy and elegant for your asynchronous functions to run on isolate, just add ".isolate" or ".isolateX" (x is the number [0-6])

Features #

Just call ".isolate" or ".isolateX" to make your asynchronous function to run on isolate

Getting started #

import 'package:isolate_classy/isolate_classy.dart';
copied to clipboard

Usage #

  • 1.Asynchronous functions without named parameters run on isolate

Just add ".isolate" to the name of a function to make it run on a isolate。

Future<int> func(int a1,int a2,int a3) async{
}

await func(1,2,3);//runs on the main isolate
await func.isolate(1,2,3);//runs on the new isolate
copied to clipboard
  • 2.Asynchronous functions without named parameters run on isolate
Future<int> func({double width,double height,Color? color})async{
}
Future<int> func6(int a1,int a2,int a3,int a4,int a5,int a6,{double width,double height,Color? color})async{
}

await func.isolate({#width:100,#height:200,#color: Colors.blue});//There are no positional parameters
await func1.isolate1(1,{#width:100,#height:200,#color: Colors.blue});//1 positional parameters
//...
await func1.isolate6(1,2,3,4,5,6,{#width:100,#height:200,#color: Colors.blue});//1 positional parameters
copied to clipboard

Additional information #

This article explains the principle.

If an asynchronous function with named parameters uses the return value, you need to specify the return value type.

int ret=await func.isolate({#width:100,#height:200,#color: Colors.blue});
//or
ret=await func.isolate<int>({#width:100,#height:200,#color: Colors.blue});
copied to clipboard
2
likes
130
points
30
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.22 - 2025.04.06

It makes very easy and elegant for your asynchronous functions to run on isolate.

Repository (GitHub)

Documentation

API reference

License

unknown (license)

More

Packages that depend on isolate_classy