|
1 | | -/// When working with isolates, wiring up the `SendPort`s, the `ReceivePort`s correctly |
2 | | -/// is a lot of boilerplate code when all you want to do is spawn an isolate, compute something, and use the computed value. |
| 1 | +/// When working with isolates, wiring up the `SendPort`s, the `ReceivePort`s |
| 2 | +/// correctly is a lot of boilerplate code when all you want to do is spawn an |
| 3 | +/// isolate, compute something, and use the computed value. |
3 | 4 | /// |
4 | | -/// Flutter's `compute` function is a very useful abstraction over isolates that can be useful in all kinds of Dart apps. |
| 5 | +/// Flutter's `compute` function is a very useful abstraction over isolates that |
| 6 | +/// can be useful in all kinds of Dart apps. |
5 | 7 | /// |
6 | | -/// Unfortunately, Flutter's `compute` function is not available for a Dart package is it doesn't use Flutter. |
7 | | -/// Examples where this can be the case are command-line and server-side applications. |
| 8 | +/// Unfortunately, Flutter's `compute` function is not available for a Dart |
| 9 | +/// package that doesn't use Flutter, for example command-line and server-side |
| 10 | +/// applications. |
8 | 11 | /// |
9 | | -/// This package addresses this issue. It extracts the `compute` function from Flutter and makes it available |
10 | | -/// for all Dart projects, so if you wish to perform some computation on a separate isolate and use its return value |
11 | | -/// in a command line tool, or any kind of non-Flutter Dart project, now you can! |
| 12 | +/// This package addresses this issue. It extracts the `compute` function from |
| 13 | +/// Flutter and makes it available for all Dart projects, so if you wish to |
| 14 | +/// perform some computation on a separate isolate and use its return value, |
| 15 | +/// now you can! |
| 16 | +/// |
| 17 | +/// **Disclaimers** |
12 | 18 | /// |
13 | 19 | /// Do not assume that using `compute` will automatically speed up your code: |
14 | | -/// you should benchmark your Dart applications *with* and *without* the `compute` function, |
15 | | -/// and only switch to using `compute` if it really speeds up your application. |
| 20 | +/// you should benchmark your Dart applications |
| 21 | +/// *with and without the `compute` function*, and only switch to using |
| 22 | +/// `compute` if it really speeds up your application. |
16 | 23 | /// |
17 | | -/// Keep in mind, that by using `compute`, you lose some flexibility that working directly with isolates would enable you. |
| 24 | +/// Keep in mind, that by using `compute`, you lose some flexibility that |
| 25 | +/// working directly with isolates would enable you. |
18 | 26 | /// |
19 | | -/// The package is safe to be used on web, but there will be no real isolates spawned |
| 27 | +/// The package is safe to be used on web, but there will be no real isolates |
| 28 | +/// spawned. |
20 | 29 | /// |
21 | | -/// Changes are synced with Flutter's stable branch only (and they are currently synced manually). |
| 30 | +/// Changes are synced with Flutter's stable branch only (and they are currently |
| 31 | +/// synced manually). |
22 | 32 | export 'src/compute.dart'; |
0 commit comments