init method
Future<void>
init({
- String? storageKey,
- HummErrorStorage? errorStorage,
- List<
HummErrorTracker> ? trackers, - int? logSize,
- ErrorDisplayCallback? errorDisplayCallback,
- ErrorTranslationCallback? errorTranslationCallback,
- bool shouldDisplayErrorCallback(
- dynamic error,
- StackTrace stackTrace
- String? defaultErrorMessage,
Initialize the error handler with basic configuration
Implementation
Future<void> init({
String? storageKey,
HummErrorStorage? errorStorage,
List<HummErrorTracker>? trackers,
int? logSize,
ErrorDisplayCallback? errorDisplayCallback,
ErrorTranslationCallback? errorTranslationCallback,
bool Function(dynamic error, StackTrace stackTrace)? shouldDisplayErrorCallback,
String? defaultErrorMessage,
}) async {
this.errorStorage = errorStorage ?? await HummErrorStorageImpl.create(storageKey: storageKey ?? StorageKey.key);
// Set log size if provided
if (logSize != null) {
this.logSize = logSize;
}
if (trackers != null && trackers.isNotEmpty) {
_trackers.addAll(trackers);
}
_errorDisplayCallback = errorDisplayCallback;
_errorTranslationCallback = errorTranslationCallback;
_shouldDisplayErrorCallback = shouldDisplayErrorCallback;
if (defaultErrorMessage != null) {
_defaultErrorMessage = defaultErrorMessage;
}
}