initialize method

Future<void> initialize()

Initialise the Hive service and open boxes.

Implementation

Future<void> initialize() async {
  if (_isInitialized) return;

  try {
    _movieBox = await Hive.openBox<List<dynamic>>('movies');
    _timestampBox = await Hive.openBox<DateTime>('cache_timestamps');
    _isInitialized = true;
  } catch (e) {
    debugPrint('Error initializing Hive cache service: $e');
    rethrow;
  }
}