NitroInstanceRegistry class
Dart-side registry mapping native instance IDs to live impl objects.
Every generated _XxxImpl registers itself on construction and
auto-unregisters when GC'd (via Finalizer) or when dispose() is called.
This enables zero-native-call downcasting:
AnyNativeObject ref = plugin.getRef();
final foo = NitroInstanceRegistry.resolve<Foo>(ref); // typed, no C round-trip
Only resolves instances created in the same Dart isolate — Dart isolates have separate heaps and independent registries.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
register(
int id, Object instance) → void -
Registers
instanceunderid. Called by every generated_XxxImplconstructor. -
resolve<
T extends Object> (AnyNativeObject ref) → T? -
Returns the registered instance for
refcast toT, or null if not found, already disposed, or GC'd before this call. -
unregister(
int id, Object instance) → void -
Removes
instancefrom the registry. Called fromdispose().