one<T> static method

ReactCallback one<T>(
  1. void callback(
    1. T value
    ), {
  2. ReactValueSpec argument = reactAny,
  3. String? debugName,
})

Wraps a one-argument callback that returns no value.

argument tells the renderer how to decode the incoming JavaScript value before it is cast to T. It defaults to a nullable arbitrary value, which is suitable for exploratory foreign-component APIs.

Implementation

static ReactCallback one<T>(
  void Function(T value) callback, {
  ReactValueSpec argument = reactAny,
  String? debugName,
}) => ReactCallback(
  debugName: debugName,
  signature: (positional: [argument], result: reactVoid, asynchronous: false),
  invoke: (arguments) {
    callback(arguments[0] as T);
    return null;
  },
);