hook_controller

Last updated:

0 purchases

hook_controller Image
hook_controller Images
Add to Cart

Description:

hook controller

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'.
}

copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.