level property

DiagnosticLevel level

Priority level of the diagnostic used to control which diagnostics should be shown and filtered.

The property level defaults to the value specified by the level constructor argument. The level is raised to DiagnosticLevel.error if an exception was thrown getting the property value. The level is raised to DiagnosticLevel.warning if the property value is null and the property is not allowed to be null due to missingIfNull. The priority level is lowered to DiagnosticLevel.fine if the property value equals defaultValue.

Implementation

@override
DiagnosticLevel get level {
  if (_defaultLevel == DiagnosticLevel.hidden)
    return _defaultLevel;

  if (exception != null)
    return DiagnosticLevel.error;

  if (value == null && missingIfNull)
    return DiagnosticLevel.warning;

  // Use a low level when the value matches the default value.
  if (defaultValue != kNoDefaultValue && value == defaultValue)
    return DiagnosticLevel.fine;

  return _defaultLevel;
}