I'm using schedule notification, schedule function takes:
I can access id, title and body, but not scheduledDate.
How can I get the scheduledDate of pending notification?
This is the code (using the flutter_local_notifications package):
FutureBuilder(
future: flutterLocalNotificationsPlugin.pendingNotificationRequests(),
builder: (context,ss){
if(ss.hasError){
print('Error');
}
if(ss.hasData){
List<PendingNotificationRequest> appointments = ss.data;
return ListView.builder(
itemCount: appointments.length,
itemBuilder: (context,position){
return Card(
child: Column(
children: <Widget>[
Text('id: ${appointments[position].id}'),
Text('title: ${appointments[position].title}'),
Text('body: ${appointments[position].body}'),
],
),
);
});
}else{
return SpinKitRipple(color: Colors.blue[800],);
}
},
)
You can add your date in payload as String parameter when you schedule notification then when you fetch Pending notifications ,get the payload then convert it to DateTime
This is a solution for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With