The Dart SDK is currently in experimental status. If you would like to provide feedback, please reach out to us with your suggestions and comments on our Discord.
Dart - schedule.every()
Sets the frequency and one or many handlers to be triggered.
import 'package:nitric_sdk/nitric.dart';
// Create a schedule that runs every 3 hours
Nitric.schedule("send-reminder").every("3 hours", (ctx) async {
// do some processing
return ctx;
});
Parameters
- Name
rate
- Required
- Required
- Type
- String
- Description
The rate to run the schedule, e.g., '7 days'. All rates accept a number and a frequency. Valid frequencies are 'days', 'hours', or 'minutes'.
- Name
handler
- Required
- Required
- Type
- IntervalHandler
- Description
Callback services to use as the handler which will run on the defined frequency.
Examples
Create a Schedule to run every 3 minutes
import 'package:nitric_sdk/nitric.dart';
// Create a schedule that runs every 3 minutes
Nitric.schedule("send-reminder").every("3 minutes", (ctx) async {
// code which sends a reminder
return ctx;
});