warn function

void warn(
  1. String message, {
  2. bool deprecation = false,
})

Prints a warning message associated with the current @import or function call.

If deprecation is true, the warning is emitted as a deprecation warning.

This may only be called within a custom function or importer callback.

Implementation

void warn(String message, {bool deprecation = false}) =>
    switch (EvaluationContext.currentOrNull) {
      var context? =>
        context.warn(message, deprecation ? Deprecation.userAuthored : null),
      _ when deprecation => (const Logger.stderr())
          .warnForDeprecation(Deprecation.userAuthored, message),
      _ => (const Logger.stderr()).warn(message)
    };