hook_controller 1.1.1 copy "hook_controller: ^1.1.1" to clipboard
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
90
points
23
downloads

Publisher

unverified uploader

Weekly Downloads

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)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on hook_controller