InteractionTracker constructor

InteractionTracker({
  1. StorageBackend? storage,
})

Factory constructor that accepts a custom storage backend

Implementation

factory InteractionTracker({StorageBackend? storage}) {
  if (_instance != null) {
    if (storage != null && _instance!._storage != storage) {
      // If a different storage is provided, create a new instance
      return InteractionTracker._internal(storage);
    }
    return _instance!;
  }
  return _instance =
      InteractionTracker._internal(storage ?? LocalStorageBackend());
}