ManagedResource class

A resource with a create/dispose lifecycle and single-owner semantics.

There is nothing transport-specific here — it is the plain IResource bookkeeping every transport needs: guard against double-create and double-dispose, and refuse to be adopted by a second manager without being released from the first.

That last rule is what keeps ownership transfers honest. PeerHandle.take depends on it: a handle can only move from discovery to a stream by first being released, so there is never a moment where two owners both believe they may free the underlying resource.

Implemented types
Mixed-in types
Implementers

Constructors

ManagedResource({required String id, IResourceManager? manager})
Creates a resource with the given id and optional initial manager.

Properties

created → bool
Indicates whether the ILifecycle implementation has been created.
no setteroverride
description → String?
Returns a description of the identity.
no setteroverride
disposed → bool
Indicates whether the ILifecycle implementation has been disposed.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
id → String
Returns a unique identifier for the identity.
final
manager → IResourceManager?
gets the resource manager that manages this resource
no setteroverride
name → String
Returns a human-readable name for the identity.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shadowUId ↔ String?
getter/setter pairinherited
uId → String
Returns a unique identifier that is guaranteed to be globally unique.
no setterinherited

Methods

create() → FutureOr<void>
Marks the resource created.
override
dispose() → FutureOr<void>
Disposes the ILifecycle implementation, releasing any resources.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
updateManager(IResourceManager? newManager) → void
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited