onError method

void onError(
  1. Object error,
  2. StackTrace stackTrace
)

Global error handler for this module's lifecycle.

Called whenever an error occurs during onBind, onInit, or onDispose.

error The exception or object thrown. stackTrace The stack trace associated with the error.

Implementation

void onError(Object error, StackTrace stackTrace) {
  debugPrint('[$id] Error: $error');
  debugPrint(stackTrace.toString());
}