Flutter's compute function made available for all non-Flutter Dart programs

Overview

compute

Flutter's compute function made available for all non-Flutter Dart programs

The compute package takes Flutter's compute function and makes it available for all Dart programs.

Continuous Integration compute Published by dartside.dev GitHub Stars Count

Important links

If you enjoy using this package, a thumbs-up on pub.dev would be highly appreciated! 👍 💙

Motivation

Working with isolates, wiring up the SendPorts, the ReceivePorts is a lot of boilerplate code just to spawn an isolate, compute something, and use the computed value.

The compute function is a very useful abstraction over isolates that can be useful in all kinds of Dart apps.

This package addresses this issue. It extracts the compute function from Flutter and makes it available for all Dart projects, so if you wish to perform some computation on a separate isolate and use its return value in a Dart web app, command line tool, or any kind of non-Flutter Dart project, now you can!

Keep in mind, that by using compute, you lose some flexibility that working directly with isolates would enable you. Please also keep in mind that you should benchmark your Dart applications with and without the compute function, and only switch to using compute if it really speeds up your application.

Usage

Dart

This package works everywhere and doesn't have any Flutter-specific dependency.

import 'package:compute/compute.dart';

int square(int a) => a * a;

Future<void> main() async {
  final squared = await compute(square, 5);
  print('5^2=$squared');
}

Flutter

If you are on a Flutter project, you don't need this package. This package should only be used in environments where you cannot use Flutter's compute function.

For your Flutter project, use the compute function directly from Flutter's foundation.

You might also like...

This is Math-Puzzle game made in flutter and available on Playstore & AppStore

This is Math-Puzzle game made in flutter and available on Playstore & AppStore

Math Matrix : Train Your Brain, Improve Math Skill Train Your Brain · Report Bug · Request Feature Math Matrix is a Math Game that tries improvise you

Dec 30, 2022

Workout Tracker App built using Flutter and Dart. The app is available on PlayStore

Workout Tracker App built using Flutter and Dart. The app is available on PlayStore

Jun 21, 2022

Tasawq App — Flutter framework and Firebase An application that objectives to display all nearby stores of all kinds and real estate.

Tasawq App — Flutter framework and Firebase An application that objectives to display all nearby stores of all kinds and real estate. Multi-vendor, standard user login to view nearby products and stores for rating, follow-up, messaging and more

Nov 10, 2022

Find The Latest trending and upcoming movies and tv shows with MovieDB app. The app contains all info about movies and tv shows. find similar movies or shows, Browse all genres, video trailers, backdrops, logos, and posters.

MovieDB App Features. Dynamic Theming Search Functionality Onboarding-Screen Select favourite movie Home Screen Tranding movie Movies different catego

Dec 12, 2022

👉 A light-weight Emoji 📦 for Flutter and Dart-based applications with all up-to-date emojis 😄. Made from 💯% ☕ with ❤️!

flutter_emoji 👉 A light-weight Emoji 📦 for Flutter and Dart-based applications with all up-to-date emojis 😄 . Made from 💯 % ☕ with ❤️ ! Inspired f

Nov 4, 2022

Login-with-Register-page - A Login with Register page combined with all movable images made with Dart

Login-with-Register-page - A Login with Register page combined with all movable images made with Dart

Flutter login page with register page A new dart project designed for login page

Aug 2, 2022

Live portfolio designed using Flutter 2.0 available for android and web.

Live portfolio designed using Flutter 2.0 available for android and web.

DevFolio - Portfolio for Developers Designed live portfolio using Flutter 2.0. Available for Android and Web. 💻 How to install? Before these steps ma

Jan 7, 2023

Speed Share is a highly available file sharing terminal on LAN(local area network) developed by flutter framework.

Speed Share is a highly available file sharing terminal on LAN(local area network) developed by flutter framework.

速享 Language: 中文简体 | English 这是一款完全基于局域网的文件互传终端,速享不使用任何服务器,不使用您的移动流量,不收集任何用户数据,完全的点对点传输。 可以快速共享文本消息,图片或其他文件,文件夹。 适用于局域网中的文件互传,解决 QQ,微信等上传文件会经过服务器的问题,或者

Dec 31, 2022
Comments
Owner
dartside.dev
Hacking on Flutter and Dart.
dartside.dev
This is a dart package that converts words to numbers. It can be used in Flutter and normal Dart programs

Wordstonumbers.dart Wordstonumbers.dart is a simple dart package that converts a string of simple worded numbers into digits (e.g one hundred -> 100).

Michael Essiet 3 Oct 17, 2022
GitHub Action that uses the Dart Package Analyzer to compute the Pub score of Dart/Flutter packages

Dart/Flutter package analyzer This action uses the pana (Package ANAlysis) package to compute the score that your Dart or Flutter package will have on

Axel Ogereau-Peltier 45 Dec 29, 2022
A non-official package to use QOSIC on your Dart and Flutter app

Qosic Dart A Very Good Project created by Very Good CLI. About ❓ This package is a simple way to handle Qosic's USSD payment. It allows you to integra

Elikem (Junior) Medehou 4 Dec 8, 2022
A Flutter package to make your text selectable for web and non-selectable for native builds.

PlatformText A Flutter package to make your text selectable for web and non-selectable for native builds. Features PlatformText returns Text or Select

Piotr Rozpończyk 1 Jun 9, 2022
App de teste que executa uma função de fibonacci em background utilizando compute.

app_isolate_compute A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you star

Isaque Santos Paixão 0 Jan 7, 2022
Flutter application for latest news by top newspapers . And allow for share articles with friends. Now available in night mode. Also landscape mode is available

Breaking News Latest news for almost 55 country. Feature of saving article and search ariticles. Used API https://newsapi.org/ Note: if data is not ge

null 7 Oct 24, 2022
Flutter-sorted-chips-row - Flutter library for rendering a row of Material "Chip" buttons that gets sorted according to the given function

sorted_chips_row A Flutter Widget displaying a row of Material Chips, sorted according to the provided comparison function. How to use Adding dependen

Callstack Incubator 29 Jul 29, 2021
CRUD Table Flutter consists of a Lazy loading function, resizable columns, and integrated CRUD Form.

CRUD Table Flutter CRUD Table Flutter is a package for crating CURD-UI for your entity/object/class easily. It consists of a Lazy loading function, re

null 10 Dec 31, 2022
FlutterAgoraFirebaseVideoCall (Agora RTC, Bloc Pattern, Cubit, Firestore, Cloud Function, FCM)

Flutter Agora Fully Functional Video Call module Tech Stack Client: Dart, Flutter Server: Firebase firestore, Google cloud functions Techniques: *BloC

Youssef Elshiaty 39 Dec 16, 2022
CoVAC is an all-in-one Covid info toolkit app, providing users the facility to check for available slots along with receiving the latest updates related to the pandemic and the virus.

CoVAC - Covid 19 Vaccine Availability Checker Introduction ?? CoVAC is an android application developed to provide users the facility to check the ava

Aryan Kenchappagol 6 Dec 29, 2021