build method

HiPlugin build()

Builds the HiPlugin for installation.

Implementation

HiPlugin build() {
  final hooks = <dynamic>[];

  if (enableTouch) {
    hooks.add(lruTouchHook(
      uid: 'lru:touch',
      events: readEvents,
      metaKey: metaKey,
      lastAccessedKey: lastAccessedKey,
      accessCountKey: accessCountKey,
      trackAccessCount: trackAccessCount,
      nowProvider: nowProvider,
    ));
  }

  if (enableInit) {
    hooks.add(lruInitHook(
      uid: 'lru:init',
      events: writeEvents,
      metaKey: metaKey,
      lastAccessedKey: lastAccessedKey,
      accessCountKey: accessCountKey,
      nowProvider: nowProvider,
    ));
  }

  return HiPlugin(
    name: 'lru',
    version: '1.0.0',
    description: 'Least Recently Used cache management',
    hooks: hooks.cast(),
  );
}