e static method

void e(
  1. Object error, [
  2. StackTrace? stackTrace
])

打印错误日志(主要用于 catch 块)

  • error 异常对象
  • stackTrace 堆栈信息(可选,如果传 null 则会自动捕获当前堆栈)

Implementation

static void e(Object error, [StackTrace? stackTrace]) {
  if (!kDebugMode) return;

  final stack = stackTrace ?? StackTrace.current;
  final message = error.toString();
  _log('ERROR', message, stackTrace: stack);
}