hook_controller 1.1.1 icon indicating copy to clipboard operation
hook_controller: ^1.1.1 copied to clipboard

Simple hooks system, used to modify value or the context of specific type by series of hooks, each one gets the previous value and the commit method to apply changes.

HookController #

Simple hooks system, used to modify value or the context of specific type by series of hooks, each one gets the previous value and the commit method to apply changes.

Usage #

A simple usage example:

import 'package:hook_controller/hook_controller.dart';

void main() async {
  final beforeSendHook = HookController<String>();

  // salt password
  beforeSendHook.registerHook(
    (password, commit) => commit('salt $password salt'),
  );

  // hash password
  beforeSendHook.registerHook(
    (password, commit) => commit('hash $password hash'),
  );

  final String password = 'my_password';

  final hashedPassword = await beforeSendHook.execute(password);
  print(
    'Hashed password is \'$hashedPassword\'.',
  ); // Hashed password is 'hash salt my_password salt hash'.
}

0
likes
110
pub points
0%
popularity

Publisher

unverified uploader

Simple hooks system, used to modify value or the context of specific type by series of hooks, each one gets the previous value and the commit method to apply changes.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.BSD-3-Clause (LICENSE)

More

Packages that depend on hook_controller