ReactCallback class final
Opaque callback descriptor that can be passed through the JS bridge.
Application code creates descriptors via generated component prop
adapters or typed intrinsic factories. The descriptor itself contains
no JS interop types; conversion to a JS function happens only in
package:react_js.
final callback = ReactCallback(
debugName: 'button.onClick',
signature: const (
positional: [reactHostValue],
result: reactVoid,
asynchronous: false,
),
invoke: (arguments) {
final rawEvent = arguments[0];
// cast and handle in renderer-specific code
return null;
},
);
Constructors
-
ReactCallback({required ReactCallbackSignature signature, required Object? invoke(List<
Object?> ), String? debugName}) -
const
Properties
- debugName → String?
-
Optional name used in argument-count error messages.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
invoke
→ Object? Function(List<
Object?> ) -
Invocation adapter that receives decoded Dart arguments.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signature → ReactCallbackSignature
-
Signature metadata for argument decoding and result encoding.
final
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
-
one<
T> (void callback(T value), {ReactValueSpec argument = reactAny, String? debugName}) → ReactCallback - Wraps a one-argument callback that returns no value.
-
two<
A, B> (void callback(A first, B second), {ReactValueSpec first = reactAny, ReactValueSpec second = reactAny, String? debugName}) → ReactCallback - Wraps a two-argument callback that returns no value.
-
zero(
void callback(), {String? debugName}) → ReactCallback - Wraps a no-argument callback that returns no value.