Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get the [ scheduledDate ] of pending notification (flutter local notification)

I'm using schedule notification, schedule function takes:

  • id
  • title
  • body
  • scheduledDate

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],);
          }
        },
      )
like image 763
ahmed el-shafei Avatar asked Oct 20 '25 17:10

ahmed el-shafei


1 Answers

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

like image 77
Islam Emam Avatar answered Oct 23 '25 08:10

Islam Emam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!