closeAll method

Future<void> closeAll()

Close all cache instances (call when app is shutting down)

Implementation

Future<void> closeAll() async {
  final futures = <Future<void>>[];

  if (_memoryCache != null) {
    futures.add(_memoryCache!.close());
  }
  if (_persistentCache != null) {
    futures.add(_persistentCache!.close());
  }
  if (_apiCache != null) {
    futures.add(_apiCache!.close());
  }
  if (_userDataCache != null) {
    futures.add(_userDataCache!.close());
  }

  await Future.wait(futures);
}