build method

HiPlugin build()

Builds the HiPlugin for installation.

Implementation

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

  if (enableEncode) {
    hooks.add(base64EncodeHook(
      uid: 'base64:encode',
      events: writeEvents,
      urlSafe: urlSafe,
    ));
  }

  if (enableDecode) {
    hooks.add(base64DecodeHook(
      uid: 'base64:decode',
      events: readEvents,
      urlSafe: urlSafe,
      asString: decodeAsString,
    ));
  }

  return HiPlugin(
    name: 'base64',
    version: '1.0.0',
    description: 'Base64 encoding/decoding for payload values',
    hooks: hooks.cast(),
  );
}