This a library to simplify isolate thread communication.

Overview

License: MIT Build Status

This a library to simplify islate thread communication. It abstracts the data transfer between islate and the main thread into a simple channel, and the channel only needs to listen for data changes and close the channel, thus simplifying the data communication of islate.

Features

  • channel abstraction.
  • Data Listening.
  • Message Channel Close event.

Getting started

start using the package.

Usage

import 'package:wuchuheng_isolate_channel/src/service/task/index.dart';
import 'package:wuchuheng_isolate_channel/wuchuheng_isolate_channel.dart';
import 'package:wuchuheng_logger/wuchuheng_logger.dart';

void main() async {
    /// Isolate logic code.
    final Task task = await IsolateTask((message, channel) {
        Logger.info('isolate: receive $message');
        channel.send('task data');
        channel.onClose((name) => Logger.info('Channel is closed. channel: $name.'));
    });

    ///Main thread code.
    final channel = task.createChannel(name: 'channelName')
        ..listen((message, channel) => Logger.info('Receiving isolate messages')).cancel();
    channel.send('Send data to isolate');
    await Future.delayed(Duration(seconds: 1));

    ///Turn off the channel
    channel.close();

    /// listen to future
    final task2 = await IsolateTask((message, channel) {
        channel.send(message);
    });
    final channel2 = task2.createChannel();
    final result = channel2.listenToFuture();
    channel.send('OK');
    print(await result); // print 2

}

Additional information

contribute to the package, how to file issues, what response they can expect from the package authors, and more.

You might also like...

Powerful, helpfull, extensible and highly customizable API's that wrap http client to make communication easier with Axelor server with boilerplate code free.

Powerful, helpfull, extensible and highly customizable API's that wrap http client to make communication easier with Axelor server with boilerplate code free.

flutter_axelor_sdk Powerful, helpful, extensible and highly customizable API's that wrap http client to make communication easier with Axelor server w

Dec 25, 2022

Anonchat-v2 - Anonchat - A microprotocol for communication build on Dart using sockets

AnonChat Originally made by Arslee on arslee07/anonchat. What's this? Anonchat i

Nov 11, 2022

Dart package to which makes data communication easy among different modules of your application.

Dart package to which makes data communication easy among different modules of your application.

LiveStream - Dart LiveStream is a data holder class which can observe change of data in real-time and emit values too. Here's emitter subscriber patte

Sep 28, 2022

Allows communication between your bot and the Web App built in Flutter displayed inside Telegram.

tele_web_app It enables communication between your bot and the Flutter-embedded Web App displayed inside Telegram by making use of interoperability be

Dec 8, 2022

A Flutter plugin that allows communication with a Parse Server

A Flutter plugin that allows communication with a Parse Server

Parse For Flutter! Hi, this is a Flutter plugin that allows communication with a Parse Server, (https://parseplatform.org) either hosted on your own s

Apr 14, 2022

An example of "reactive/streaming repository" as a solution for BLoC to BLoC communication

An example of

Reactive Repositories An example of listening to a Stream from repository layer (instead of explicitly using get/fetch) as a solution for BLoC to BLoC

Jan 3, 2023

Flutter Control is complex library to maintain App and State management. Library merges multiple functionality under one hood. This approach helps to tidily bound separated logic into complex solution.

Flutter Control is complex library to maintain App and State management. Library merges multiple functionality under one hood. This approach helps to tidily bound separated logic into complex solution.

Flutter Control is complex library to maintain App and State management. Library merges multiple functionality under one hood. This approach helps to

Feb 23, 2022

[Flutter Library] Flamingo is a firebase firestore model framework library. 🐤

[Flutter Library] Flamingo is a firebase firestore model framework library. 🐤

Flamingo Flamingo is a firebase firestore model framework library. https://pub.dev/packages/flamingo 日本語ドキュメント Example code See the example directory

Sep 22, 2022

Flutter-Animated-Library-of-Books - Flutter App - Animated Book Library

bookshelf A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Dec 4, 2022
An isolated worker for Flutter (Isolate) and Web (Web Worker). Behaves almost the same as the compute function, except it is not a one-off worker.

A singleton isolated worker for all platforms. On most platforms, it uses Flutter's Isolate, except on the web, since Isolate is not available, it use

Iandi Santulus 30 Nov 11, 2022
Aplicativo de teste que roda em background timer atual utilizando Isolate.

# isolate_app A new Flutter project. ## Getting Started This project is a starting point for a Flutter application. A few resources to get you sta

Isaque Santos Paixão 1 Jun 20, 2022
A Flutter package which allows you to work with MethodChannels in Isolate.

A Flutter package which allows you to work with MethodChannels in Isolate. Also it provides simplified multiplatform Isolate API.

Zemlaynikin Max 19 Jan 4, 2023
Learn how to build a multi-step form flow and how to use bloc to effectively isolate the presentation layer from the business logic layer.

Multi-page Form Flow Learn how to build a multi-step form flow and how to use bloc to effectively isolate the presentation layer from the business log

Sandip Pramanik 15 Dec 19, 2022
Isolate helper for flutter and dart.

Isolation Overview The package simplifies the creation and interaction between isolates. It encapsulates the entire boilerplate, leaving the developer

Plague Fox 15 Oct 29, 2022
Dart package that conveniently wraps an isolate, ports and state for easy isolates.

Isolate Agents Description Isolate Agents adds a new class, Agent, which is a proper implementation of the Actor model for Dart. Where Isolates have n

null 65 Jan 2, 2023
Flutter package to simplify pagination of list of items from the internet.

PaginationView Installing In your pubspec.yaml dependencies: pagination_view: ^2.0.0-nullsafety.0 import 'package:pagination_view/pagination_view.da

Venkatesh Prasad 151 Dec 29, 2022
A flutter package to simplify pagination with firestore data 🗃

Pagination in Firestore Setup Use the same setup used for cloud_firestore package (or follow this). Usage In your pubspec.yaml dependencies: paginat

Venkatesh Prasad 101 Dec 23, 2022
Flutter package to simplify pagination of list of items from the internet.

PaginationView Installing In your pubspec.yaml dependencies: pagination_view: ^2.0.0-nullsafety.0 import 'package:pagination_view/pagination_view.da

Venkatesh Prasad 151 Dec 29, 2022
Another breakpoint framework. Aims to simplify as much as possible building adaptive layouts.

Another breakpoint framework. Aims to simplify as much as possible building adaptive layouts. Features Really simple implementation Works with and wit

null 3 Sep 26, 2022