registerOutput<T> method

Output<T> registerOutput<T>(
  1. String propertyName, {
  2. Object? decoder(
    1. Object?
    )?,
  3. bool isSecret = false,
})
inherited

Registers a dynamic output property for this resource.

Subclasses usually expose a typed field and assign it from this method:

late final Output<String> name;
name = registerOutput<String>('name');

Implementation

Output<T> registerOutput<T>(
  String propertyName, {
  Object? Function(Object?)? decoder,
  bool isSecret = false,
}) {
  final source = OutputCompletionSource.create<T>(
    this,
    decoder: decoder,
    isSecret: isSecret,
  );
  completionSources[propertyName] = source;
  if (_pendingOutputException != null) {
    source.trySetException(_pendingOutputException!);
  } else if (_pendingResolvedOutputs != null) {
    _resolveCompletionSource(propertyName, source, _pendingResolvedOutputs!);
  }
  return source.output as Output<T>;
}