schedule_notifications 0.1.8

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 33

Schedule Notifications

A Flutter plugin 🛠 to schedule Local Notifications. Ready for iOS and Android 🚀

License

Features

  • [x] Send local notifications to iOS and Android 📢
  • [x] Schedule notifications ⏰

Requirements

  • iOS: Version 10.0+
  • Android: minSdkVersion 16

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  schedule_notifications: "^0.1.8"

Usage example

General

  • One shot:
ScheduleNotifications.schedule("Notification Text", new DateTime.now(), []);
  • Schedule notifications:
List daysToRepeat = [DateTime.sunday, DateTime.monday]; // repeat every sunday and monday
ScheduleNotifications.schedule("Notification Text", new DateTime.now(), daysToRepeat);
  • Unschedule:
ScheduleNotifications.unschedule();

Android

  • To set icon of notifications:
int iconResourceId;
try {
    iconResourceId = await _platform.invokeMethod('getIconResourceId');
} on PlatformException catch (e) {
    print('Error on get icon resource id');
}

ScheduleNotifications.setNotificationIcon(iconResourceId);

iOS

  • To request authorization of user:
ScheduleNotifications.requestAuthorization();

Contribute

We would ❤️ to see your contribution!

License

Distributed under the MIT license. See LICENSE for more information.

About

Created by Fabricio Serralvo and Marcos Aoki.

[0.1.8] - 2018/04/18

Small changes.

[0.1.7] - 2018/04/05

Bug fixes.

[0.1.6] - 2018/04/05

Bug fixes.

[0.1.5] - 2018/04/04

  • Rescheduling the alarms on reboot device (android only).

[0.1.4] - 2018/04/03

  • Changes in methods for android.

[0.1.3] - 2018/03/31

  • Changes in methods for iOS.

[0.1.2] - 2018/03/28

  • Little changes.

[0.1.1] - 2018/03/27

  • Some bugs in android was fixed.

[0.1.0] - 2018/03/27

  • Small changes and new methods.

[0.0.4] - 2018/03/26

  • Changes in flutter sdk range

[0.0.3] - 2018/03/26

  • Small changes.

[0.0.2] - 2018/03/26

  • Some changes in dependencies.

[0.0.1] - 2018/03/25

  • First release, is not ready for production.

example/lib/main.dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/foundation.dart';
import 'package:schedule_notifications/schedule_notifications.dart';
import 'package:schedule_notifications_example/time_picker.dart';


void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  static const _platform = const MethodChannel('schedule_notifications_app');

  DateTime _selectedTime = new DateTime.now();

  @override
  initState() {
    super.initState();
    if (defaultTargetPlatform == TargetPlatform.android) {
       _getIconResourceId();
    }
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new Container(
            child: new Center(
              child: new Column(
                  children: <Widget>[
                    new DateTimeItem(
                    dateTime: _selectedTime,
                        onChanged: (value) {
                          setState(() {
                            _selectedTime = value;
                          });
                        }
                    ),
                    new RaisedButton(
                      child: const Text('SCHEDULE'),
                      onPressed: _scheduleAlarm,
                    ),
                    const SizedBox(height: 20.0),
                    new RaisedButton(
                      child: const Text('UNSCHEDULE'),
                      onPressed: _unscheduleAlarm,
                    ),
                  ]
              ),
            )
        ),
      ),
    );
  }

  Future<dynamic> _getIconResourceId() async {
    int iconResourceId;
    try {
      iconResourceId = await _platform.invokeMethod('getIconResourceId');
    } on PlatformException catch (e) {
      print("Error on get icon resource id: x");
    }

    setState(() {
      ScheduleNotifications.setNotificationIcon(iconResourceId);
    });
  }

  void _scheduleAlarm() {
    try {
      ScheduleNotifications.schedule("Text", _selectedTime, []);
    } on Exception {
      print("Whooops :x");
    }
  }

  void _unscheduleAlarm() {
    try {
      ScheduleNotifications.unschedule();
    } on Exception {
      print("Whooops :x");
    }
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  schedule_notifications: ^0.1.8

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:schedule_notifications/schedule_notifications.dart';
  
Version Uploaded Documentation Archive
0.1.8 Apr 18, 2018 Go to the documentation of schedule_notifications 0.1.8 Download schedule_notifications 0.1.8 archive
0.1.7 Apr 5, 2018 Go to the documentation of schedule_notifications 0.1.7 Download schedule_notifications 0.1.7 archive
0.1.6 Apr 5, 2018 Go to the documentation of schedule_notifications 0.1.6 Download schedule_notifications 0.1.6 archive
0.1.5 Apr 4, 2018 Go to the documentation of schedule_notifications 0.1.5 Download schedule_notifications 0.1.5 archive
0.1.4 Apr 3, 2018 Go to the documentation of schedule_notifications 0.1.4 Download schedule_notifications 0.1.4 archive
0.1.3 Mar 31, 2018 Go to the documentation of schedule_notifications 0.1.3 Download schedule_notifications 0.1.3 archive
0.1.2 Mar 28, 2018 Go to the documentation of schedule_notifications 0.1.2 Download schedule_notifications 0.1.2 archive
0.1.1 Mar 27, 2018 Go to the documentation of schedule_notifications 0.1.1 Download schedule_notifications 0.1.1 archive
0.1.0 Mar 27, 2018 Go to the documentation of schedule_notifications 0.1.0 Download schedule_notifications 0.1.0 archive
0.0.4 Mar 26, 2018 Go to the documentation of schedule_notifications 0.0.4 Download schedule_notifications 0.0.4 archive

All 13 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
67
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
33
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Maintenance issues and suggestions

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <2.0.0