isolated_object
0.2.0, released 5 days ago by serverpod.dev
Wraps an object in a dedicated isolate and forwards method calls to it
What it does
Creates a separate isolate for an object and forwards method calls to that isolate, keeping timer or event-loop driven work running even when the main isolate is blocked. The API is simple: evaluate closures and close the isolate.
AI-written summary of version 0.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Heavy synchronous work blocks the UI and you need background processing
- You want to isolate a simple object that can be sent across isolates
- You need a lightweight, dependency‑free solution for background tasks
Skip it when
- The object needs to access the UI or platform channels
- You require many isolates or complex inter‑isolate communication
- You need advanced features like state management or dependency injection
Strengths
- No external dependencies
- Simple API with evaluate and close
- Keeps event loop free for timers and animations
Weaknesses
- Only works with objects that can be sent across isolates
- No support for platform channels or UI access
- Limited to single‑object isolation
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:isolated_object/isolated_object.dart';
final counter = IsolatedObject<Counter>(() => Counter());
await counter.evaluate((c) => c.increment());
final value = await counter.evaluate((c) => c.value);
await counter.close();Alternatives
Packages that do the same job and could replace isolated_object.
- isolate_channel
Communication channels for isolates based on Flutter's platform channels.
82Compare - snowplow_tracker
Flutter package for sending Snowplow analytics events on Android, iOS, and Web.
78Compare - easy_debounce
An easy-to-use method call debouncer and throttler package for Dart and Flutter.
50Compare - basics
Provides extension methods for core Dart types like String, Iterable, and DateTime.
50Compare
Works with
Packages commonly used together with isolated_object: ones it builds on, ones built on it, and its own family.