搜尋套件、儲存庫與 APP 分類

套件詳情v2.0.8

isolator

Isolator 是一個套件,可為您提供一種簡單的方式來建立兩元件狀態,包含任何類型的隔離部分和前端部分 - BLoC、MobX、ChangeNotifier 等

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
123
喜歡數
84
Pub 分數
150

安裝套件

flutter pub add isolator

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Isolator 是一個 Flutter/Dart 套件,可簡化兩元件狀態管理系統的建立,將隔離邏輯(例如 BLoC、MobX、ChangeNotifier)與 UI 層分離。它透過將狀態邏輯與呈現層解耦,實現乾淨架構,促進重用性和可測試性。該套件支援所有主要平台上的多種狀態管理解決方案,非常適合可擴展的應用程式。透過最少的設定,開發者可以輕鬆整合並以結構化方式管理狀態。

適用情境

  • 構建可重用的狀態邏輯
  • 將使用者介面與業務邏輯分離
  • 獨立測試狀態組件
  • 支援多種狀態管理模式
  • 建立模組化應用架構
  • 簡化螢幕之間的狀態共享

主要特色

  • 兩元件狀態分離
  • 支援 BLoC、MobX、ChangeNotifier
  • 跨平台相容性
  • 與現有狀態管理器的輕鬆整合
  • 輕量級且最小化樣板程式碼
  • 內建測試支援

適合對象

  • 使用 BLoC/MobX/ChangeNotifier 的開發者
  • 採用整潔架構的團隊
  • 需要可測試狀態邏輯的項目
  • 具有複雜狀態需求的應用程式
  • 尋求模組化的Flutter開發者

使用建議

  • 需要理解狀態管理模式
  • 最適合中大型應用
  • 可能為簡單使用案例增加複雜性
  • 可用文件有限
  • 不是專用狀態庫的完整取代品

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

License Pub

Isolator

Do you ever want to use isolates in your app, but think, that it is very complex? Or, maybe, you feel that your app has some lugs when you open some screen, which needs data from a backend? With the Isolator, all these problems go out. Have an always stable frame rate at 60 / 120 per second. Don't have any problems with UI-thread junks. And feel happy.


Demo of app, which using Isolator.

Source code of this app.


Description

Isolator is a package, which offer to you a simple way for creating two-component states with isolated part, named Backend and Frontend part in UI-isolate of any kind (BLoC, MobX, ChangeNotifier, and many others).

With Isolator you can use all benefits of isolate API without boilerplate code.

Also, Isolator works with Flutter Web, but without multi-threading (because Dart itself has no Web support for isolate API).

Main concepts

Frontend

Frontend - this is the first part of your two-classes logic component. It can use any state management as a base to update your UI: ChangeNotifier, Mobx, Bloc, and any another.

Frontend's mission is in calling Backend's methods, which must be registered through whenEventCome(SomeEvent).run(_someBackendMethod) method in Backend.

Also, Frontend can register its own message handlers in the same manner: whenEventCome(SomeEvent).run(someFrontendMethod) to react on Backend's messages.

And also you can subscribe on your Frontend to get notifications about new messages from the corresponding Backend.

Backend

Backend - this is the second part of the two-classes logic component. All Backend's will run in separated isolate and doesn't affect to UI-isolate. That means, that if you have CPU-heavy logic, big-data parsing or manipulating - you can do this in your Backend and your interface will not drop any frame at all!

Interactor

Interactor - it is an additional part of Backend, which is used to communicate between any Backends without affecting UI-isolate.

Other

You can run each Backend in its separate isolate, or you can run part of Backends in one isolate and another part in another isolate (with pool param).

If you want to know all possibilities of this package, please - investigate this project, which I made to show how Isolator can be used. Also, you can research the tests for the Isolator itself, which have examples for almost all API.

Articles about Isolator

And finally - at the moment I am writing several articles about using my Open Source packages in real projects and when they will be ready - I will attach links to this readme in order to explain in as much detail as possible how to get the most advantages out of this library and from others too.

Schema of interaction

Schema

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。