{"id":18254968,"url":"https://github.com/vincevargadev/compute_dart","last_synced_at":"2025-07-28T22:40:57.761Z","repository":{"id":60661041,"uuid":"474375456","full_name":"vincevargadev/compute_dart","owner":"vincevargadev","description":"Flutter's compute function made available for all non-Flutter Dart programs","archived":false,"fork":false,"pushed_at":"2022-08-14T13:21:31.000Z","size":20,"stargazers_count":14,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-04T17:36:50.399Z","etag":null,"topics":["concurrent","dart","isolate"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/compute","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vincevargadev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-26T14:42:43.000Z","updated_at":"2025-01-22T12:42:38.000Z","dependencies_parsed_at":"2022-10-02T20:40:24.229Z","dependency_job_id":null,"html_url":"https://github.com/vincevargadev/compute_dart","commit_stats":null,"previous_names":["vincevargadev/compute_dart","dartsidedev/compute"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/vincevargadev/compute_dart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincevargadev%2Fcompute_dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincevargadev%2Fcompute_dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincevargadev%2Fcompute_dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincevargadev%2Fcompute_dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vincevargadev","download_url":"https://codeload.github.com/vincevargadev/compute_dart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vincevargadev%2Fcompute_dart/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267598799,"owners_count":24113665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrent","dart","isolate"],"created_at":"2024-11-05T10:14:10.769Z","updated_at":"2025-07-28T22:40:57.745Z","avatar_url":"https://github.com/vincevargadev.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `compute`\n\n\u003e Flutter's compute function made available for all non-Flutter Dart programs\n\nThe `compute` package takes Flutter's `compute` function and makes it available for all Dart programs.\n\n[![Continuous Integration](https://github.com/dartsidedev/compute/workflows/Continuous%20Integration/badge.svg?branch=main)](https://github.com/dartsidedev/compute/actions) [![compute](https://img.shields.io/pub/v/compute?label=compute\u0026logo=dart)](https://pub.dev/packages/compute 'See compute package info on pub.dev') [![Published by dartside.dev](https://img.shields.io/static/v1?label=Published%20by\u0026message=dartside.dev\u0026logo=dart\u0026logoWidth=30\u0026color=40C4FF\u0026labelColor=1d599b\u0026labelWidth=100)](https://pub.dev/publishers/dartside.dev/packages) [![GitHub Stars Count](https://img.shields.io/github/stars/dartsidedev/compute?logo=github)](https://github.com/dartsidedev/compute 'Star me on GitHub!')\n\n## Important links\n\n* [Read the source code and **star the repo** on GitHub](https://github.com/dartsidedev/compute)\n* [Open an issue on GitHub](https://github.com/dartsidedev/compute/issues)\n* [See package on pub.dev](https://pub.dev/packages/compute)\n* [Read the docs on pub.dev](https://pub.dev/documentation/compute/latest/)\n* [Flutter `foundation`'s `compute` function](https://api.flutter.dev/flutter/foundation/compute-constant.html)\n\n**If you enjoy using this package, a thumbs-up on [pub.dev](https://pub.dev/packages/compute) would be highly appreciated! 👍💙**\n\n## Motivation\n\nWhen working with isolates, wiring up the `SendPort`s, the `ReceivePort`s correctly\nis a lot of boilerplate code when all you want to do is spawn an isolate, compute something, and use the computed value.\n\nFlutter's `compute` function is a very useful abstraction over isolates that can be useful in all kinds of Dart apps.\n\nUnfortunately, Flutter's `compute` function is not available for a Dart package that doesn't use Flutter,\nfor example command-line and server-side applications.\n\nThis package addresses this issue. It extracts the `compute` function from Flutter and makes it available\nfor all Dart projects, so if you wish to perform some computation on a separate isolate and use its return value, now you can!\n\n## Disclaimers\n\nDo not assume that using `compute` will automatically speed up your code:\nyou should benchmark your Dart applications *with and without the `compute` function*,\nand only switch to using `compute` if it really speeds up your application.\n\nKeep in mind, that by using `compute`, you lose some flexibility that working directly with isolates would enable you.\n\nThe package is safe to be used on web, but there will be no real isolates spawned.\n\nChanges are synced with Flutter's stable branch only (and they are currently synced manually).\n\n## Usage\n\n### Dart\n\nThis package works everywhere and doesn't have any Flutter-specific dependency.\n\n```dart\nimport 'package:compute/compute.dart';\n\nint square(int a) =\u003e a * a;\n\nFuture\u003cvoid\u003e main() async {\n  final squared = await compute(square, 5);\n  print('5^2=$squared');\n}\n```\n\n### Flutter\n\nIf you are on a Flutter project, you don't need this package.\nThis package should only be used in environments where you cannot use Flutter's `compute` function.\n\nFor your Flutter project, [use the `compute` function directly from Flutter's `foundation`](https://api.flutter.dev/flutter/foundation/compute-constant.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvincevargadev%2Fcompute_dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvincevargadev%2Fcompute_dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvincevargadev%2Fcompute_dart/lists"}