パッケージ、リポジトリ、アプリカテゴリを検索

GitHub リポジトリ91team/computer

コンピュータ

91team/computer open-source repository details.

コンピュータ のプロジェクト画像
スター
37
フォーク
14
最終プッシュ(UTC)
2023/04/29
プロジェクト状態
公開中

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

Computer

Computer is a lightweight library for concurrent computations, which provides Flutter's compute like API.

Features

  • Easy to use API
  • No overhead on creating & releasing isolates for each task. Workers initialized on start and ready to solve your tasks
  • Strictly defined number of workers

Note

Computer.shared() is a singleton, use Computer.create() to create new instances

How to use

Computer provides just 3 methods

turnOn()

Before using the Computer you need to turnOn it. This will create workers and initialize them. Then you may use compute() method.

final computer = Computer.create(); //Or Computer.shared()

await computer.turnOn(
  workersCount: 4, // optional, default 2
  verbose: false, // optional, default false
);
compute()

compute will execute your function inside one of the workers. Function may be async. The callback argument must be a top-level or static method of a class.

final result = await computer.compute(
  fib,
  param: 45, // optional
);
turnOff()

If you don't need workers anymore, you can turnOff the Computer. It will destroy workers.

await computer.turnOff();
Errors

ComputerError the parent error for all errors/exceptions in this package

class ComputerError implements Exception {
  final String message;
}

RemoteExecutionError shows up when something goes wrong in task

class RemoteExecutionError extends ComputerError {
  final Capability taskCapability;
}

CancelExecutionError shows up when turnOff is called but task is processing

class CancelExecutionError extends ComputerError {
  final Capability taskCapability;
}
91.team GitHub avatar
GitHub 作者

91.team ↗

Сhamber digital studio with holistic approach to generate brands, applications & devices.

Worldwide
言語Dart

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 2 件

プロジェクトに合うリポジトリを選ぶには?

用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。

  1. 名前・作者・説明で検索し、技術トピックで絞り込みます。
  2. スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
  3. 利用前に GitHub で README、ライセンス、Issues を確認します。

情報源と管理

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗