error static method

void error(
  1. String tag,
  2. String message, [
  3. Object? error,
  4. StackTrace? stackTrace,
])

Logs an error message tagged with the given tag. Optionally includes an error object and stackTrace.

Implementation

static void error(
  String tag,
  String message, [
  Object? error,
  StackTrace? stackTrace,
]) {
  // ignore: avoid_print
  print('[${DateTime.now().toIso8601String()}] [ERROR] [$tag] $message');
  if (error != null) {
    // ignore: avoid_print
    print(error);
  }
  if (stackTrace != null) {
    // ignore: avoid_print
    print(stackTrace);
  }
}