set<T> static method

void Function(T value) set<T>(
  1. String key
)

The set method takes a state variable name and returns a function that is intended to be used as a function to set the value of a variable.

Implementation

static void Function(T value) set<T>(String key) {
  return VComponent.run((vComponent) {
    return (T value) {
      final context = VContext(context: vComponent.context, key: _key);
      final T oldValue = context.get(key);
      if (oldValue != value) {
        context.set(key, value);
        VRenderer.render(vComponent);
      }
    };
  });
}