hook_controller 1.0.0 hook_controller: ^1.0.0 copied to clipboard
Simple hooks system
HookController #
Simple hooks system
Usage #
A simple usage example:
import 'package:hook_controller/hook_controller.dart';
void main() async {
final beforeSendHook = HookController<String>();
// salt password
beforeSendHook.registerHook((password, next) => next('salt $password salt'));
// hash password
beforeSendHook.registerHook((password, next) => next('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'.
}