builder property Null safety

DiagnosticPropertiesBuilder? builder

Retrieve the DiagnosticPropertiesBuilder of current node.

It will cache the result to prevent duplicate operation.

Implementation

DiagnosticPropertiesBuilder? get builder {
  if (kReleaseMode) {
    return null;
  } else {
    assert(() {
      if (_cachedBuilder == null) {
        _cachedBuilder = DiagnosticPropertiesBuilder();
        value.debugFillProperties(_cachedBuilder!);
      }
      return true;
    }());
    return _cachedBuilder;
  }
}