error static method
void
error(
- dynamic message, {
- Map<
String, dynamic> ? context, - StackTrace? stackTrace,
- 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,
);
}