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 hoursNitric.schedule("send-reminder").every("3 hours", (ctx) async {// do some processingreturn 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 minutesNitric.schedule("send-reminder").every("3 minutes", (ctx) async {// code which sends a reminderreturn ctx;});
Last updated on Nov 8, 2024