StateCallbacks class

Registers schema-state callbacks against one room's decoder.

The untyped methods mirror the string-based overloads the C# SDK keeps beside its typed API: they take the SchemaInstance to observe (use room.state! for the root) and a field name, and hand values back as dynamic. The typed path — call, giving $(instance).field... through generated extensions — is sugar over the same registrations.

Cancelling a returned subscription unregisters the native callback. ColyseusRoom.dispose disposes this object with the room.

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

call<T extends SchemaRef>(T instance) SchemaCallbacksOf<T>
Scopes the typed callback surface to instance, for the generated extension getters: $(state).players.onAdd(...).
dispose() → void
Closes every subscription and frees the native manager.
listen(SchemaInstance instance, String property, void callback(dynamic value, dynamic previousValue), {bool immediate = true}) StreamSubscription
Listen to changes of property on instance.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAdd(SchemaInstance instance, String property, void callback(dynamic value, String key), {bool immediate = true}) StreamSubscription
Listen to items added to the collection at property on instance.
onChange(SchemaInstance instance, void callback()) StreamSubscription<void>
Fires after any property of instance changes.
onRemove(SchemaInstance instance, String property, void callback(dynamic value, String key)) StreamSubscription
Listen to items removed from the collection at property on instance.
toString() String
A string representation of this object.
inherited

Operators

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