title: Flutter: Scheduled notification datetime
body: <p>I'm looking to integrate Flutter's plugin date_time_picker with local notification.</p>
  <p>So when I select a date&amp;time I also schedule a notification.</p>
  <p>Here's my code..could you help me? Now I don't have any error but code is not working.</p>
  <pre><code> class test1 extends StatefulWidget {
    @override
    _test1State createState() =&gt; _test1State();
  }
  
  class _test1State extends State {
    FlutterLocalNotificationsPlugin fltrNotification;
    String _selectedParam;
    String task;
    int val;
  
    @override
    void initState() {
      super.initState();
      var androidInitilize =
          new AndroidInitializationSettings('icon_notification');
      var iOSinitilize = new IOSInitializationSettings();
      var initilizationsSettings = new InitializationSettings(
          android: androidInitilize, iOS: iOSinitilize);
      fltrNotification = new FlutterLocalNotificationsPlugin();
      fltrNotification.initialize(initilizationsSettings,
          onSelectNotification: notificationSelected);
    }
  
    Future scheuleAtParticularTime(DateTime timee) async {
      // var time = DateTime(timee.day, timee.month, timee.year, timee.hour,
      //     timee.minute, timee.second);
      var time =
          DateTime(timee.year, timee.month, timee.day, timee.hour, timee.minute);
  
      var scheduledNotificationDateTime =
          new DateTime.now().add(new Duration(seconds: 5));
      var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
          'your other channel id',
          'your other channel name',
          'your other channel description');
      var iOSPlatformChannelSpecifics = new IOSNotificationDetails();
      NotificationDetails platformChannelSpecifics = new NotificationDetails(
          android: androidPlatformChannelSpecifics,
          iOS: iOSPlatformChannelSpecifics);
      // tz.initializeTimeZones();
      // tz.setLocalLocation(tz.getLocation('Italy'));
      await fltrNotification.schedule(1, 'scheduled title', 'scheduled body',
          scheduledNotificationDateTime, platformChannelSpecifics);
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              FlatButton(
                onPressed: () {
                  DatePicker.showDateTimePicker(context, showTitleActions: true,
                      onChanged: (date) {
                    print('change $date');
                  }, onConfirm: (date) {
                    print('confirm $date');
                    scheuleAtParticularTime(DateTime.fromMillisecondsSinceEpoch(
                        date.millisecondsSinceEpoch));
                  }, currentTime: DateTime.now(), locale: LocaleType.it);
                },
                child: Text(
                  'Select time for notification arrival',
                  style:
                      TextStyle(color: Colors.black, fontWeight: FontWeight.w900),
                ),
              ),
            ],
          ),
        ),
      );
    }
  
    Future notificationSelected(String payload) async {
      showDialog(
        context: context,
        builder: (context) =&gt; AlertDialog(
          content: Text(&quot;Notification Clicked $payload&quot;),
        ),
      );
    }
  }
  
  </code></pre>
  <p>Thanks!</p>
  <p>ps.. I've insert full code, notifications works but at random time (about 5 second after I set it from the picker)</p>