neuronErrorHandler top-level property

void Function(String message, Object error, StackTrace? stackTrace) neuronErrorHandler
getter/setter pair

Global error handler for Neuron framework errors.

This handler is called when errors occur in listeners or other Neuron operations. Override this to customize error reporting, logging, or crash analytics integration.

Default Behavior

By default, errors are printed only in debug mode to avoid cluttering release builds. Override for custom behavior:

Customization

void main() {
  // Send errors to crash reporting service
  neuronErrorHandler = (message, error, stackTrace) {
    FirebaseCrashlytics.instance.recordError(error, stackTrace);
  };

  runApp(MyApp());
}

Parameters

  • message: Context about where the error occurred
  • error: The actual error/exception object
  • stackTrace: Stack trace if available (may be null)

Implementation

void Function(String message, Object error, StackTrace? stackTrace)
    neuronErrorHandler = _defaultErrorHandler;