error static method

void error(
  1. dynamic message, {
  2. Map<String, dynamic>? context,
  3. StackTrace? stackTrace,
  4. bool alwaysPrint = false,
})

Logs an error message to the console. It will only print if your app's environment is in debug mode. You can override this by setting alwaysPrint = true. Optionally provide a stackTrace to include in the output. Use context to interpolate values into the message, e.g. 'User {id}' with {'id': '123'}.

Implementation

static void error(
  dynamic message, {
  Map<String, dynamic>? context,
  StackTrace? stackTrace,
  bool alwaysPrint = false,
}) {
  if (message is Exception) {
    _loggerPrint(
      message.toString(),
      'error',
      alwaysPrint,
      context: context,
      stackTrace: stackTrace,
    );
    return;
  }
  _loggerPrint(
    message,
    'error',
    alwaysPrint,
    context: context,
    stackTrace: stackTrace,
  );
}