schedule_notifications 0.1.8

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

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");
    }
  }
}

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 Flutter:


$ flutter packages get

Alternatively, your editor might support 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...

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6
  • Flutter: 0.3.2

Scores

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

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Run flutter format to format lib/schedule_notifications.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <2.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.6 1.14.9
meta 1.1.2
sky_engine 0.0.99
typed_data 1.1.5
vector_math 2.0.6