consume<T> method

T? consume<T>([
  1. void exec(
    1. T value
    )?
])

Implementation

T? consume<T>([void exec(T value)?]) {
  try {
    final t = Provider.of<T>(this, listen: false);
    exec?.call(t);
    return t;
  } on ProviderNotFoundException {
    return null;
  }
}