neuronErrorHandler top-level property
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 occurrederror: The actual error/exception objectstackTrace: Stack trace if available (may be null)
Implementation
void Function(String message, Object error, StackTrace? stackTrace)
neuronErrorHandler = _defaultErrorHandler;