cron_generator_annotations 0.0.2 copy "cron_generator_annotations: ^0.0.2" to clipboard
cron_generator_annotations: ^0.0.2 copied to clipboard

A very easy way to generate crons, using a class to consolidate all your cron logic.

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

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');
  }  
}

Then you can use like this

final cronObj = CronStuff();

// execute cron 
cronObj.myCronStuffs(12, requiredArg: 2);

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.

0
likes
140
pub points
10%
popularity

Publisher

unverified uploader

A very easy way to generate crons, using a class to consolidate all your cron logic.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

cron, meta

More

Packages that depend on cron_generator_annotations