error static method
void
error(
- Object error,
- StackTrace? stack, {
- String source = 'app',
- String? library,
- String? context,
Implementation
static void error(
Object error,
StackTrace? stack, {
String source = 'app',
String? library,
String? context,
}) {
if (!enabled) return;
try {
final message = error.toString();
if (_config.console != ConsoleMode.off) {
final where = [source, if (library != null) library].join(' ');
DevpulConsole.write(
'error',
'[$where] ${error.runtimeType}: $message',
color: _config.ansiColors ? ansiRed : null,
);
}
emit('error', {
'source': source,
'type': error.runtimeType.toString(),
'message': message,
'library': library,
'context': context,
'stack': stack?.toString(),
});
} catch (_) {
// Tooling errors must never reach the app.
}
}