0 purchases
cron generator annotations
This package encapsulate your methods with cron jobs, using
dart cron package and is a source_gen study case so use with caught
Quick start #
Install the following dependencies
dart pub add cron_generator_annotations dev:cron_generator
copied to clipboard
Usage #
Add the @CronBase() annotation to your class and @CronGenMethod to the
method that you desire to execute as a cron job.
final CronStuff = CronStuffBase with _$CronStuffBaseCron;
@CronBase()
class CronStuffBase {
@CronGenMethod.parse('*/1 * * * *') /// will run at every minute
void myCronStuffs(int arg, {required int requiredArg, double? optionalArg}) {
print('myMethodTestWithPositioneds original $arg requiredArg $requiredArg');
}
}
copied to clipboard
Then you can use like this
final cronObj = CronStuff();
// execute cron
cronObj.myCronStuffs(12, requiredArg: 2);
copied to clipboard
Additional information #
This package provides a wrapper for the dart cron package.
If you need documentation or have specific use cases for cron, it's recommended to use this package instead.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.