logError method

void logError({
  1. required String fileName,
  2. required String error,
  3. StackTrace? stackTrace,
  4. String? text,
})

Logs an error message with optional additional information.

If showLogs is true, logs the error information.

  • fileName: The name of the file where the error occurred.
  • error: The error message to be logged.
  • stackTrace: An optional StackTrace object to provide the stack trace of the error.
  • text: An optional additional text message to be logged.

Implementation

void logError({
  required String fileName,
  required String error,
  StackTrace? stackTrace,
  String? text,
}) {
  if (showLogs) {
    log(text.toString(),
        name: fileName, error: error, stackTrace: stackTrace);
  }
}