搜索插件、代码仓与 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 项

源码仓库

使用此插件的项目

暂无相关数据。