flutter_darwin_notification 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • new44

Flutter Darwin Notification Plugin #

A iOS Darwin Notification plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and call native darwin notification center.

Flutter Test pub package Build Status style: effective dart

Features #

  • Darwin notification center plugin for ios.
  • Support to send notification to darwin notification center.

Usage #

To use this plugin, add flutter_darwin_notification as a dependency in your pubspec.yaml file. For example:

dependencies:
  flutter_darwin_notification: 0.0.1

API #


import 'package:flutter_darwin_notification/flutter_darwin_notification.dart';

/// New instance
final center = DarwinNotificationCenter();

/// Observe notification 
final stream = center.observe(name: 'notification-name', behavior: Behavior.coalesce);
stream.listen((result) {
  /// Do something    
});

/// Post notification 
center.postNotification('notification-name', object: '1', userInfo: {'1': '2'});

Issues #

Please file any issues, bugs or feature request as an issue on our Github page.

Want to contribute #

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

Author #

This Flutter object cache package for Flutter is developed by modool. You can contact us at modool.go@gmail.com

0.0.1 #

0.0.2 #

  • fix issues.

example/lib/main.dart

import 'dart:async';

import 'package:flutter_darwin_notification/flutter_darwin_notification.dart';
import 'package:flutter/material.dart';

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

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

class _MyAppState extends State<MyApp> {
  final subscriptions = <StreamSubscription>[];

  Result result;

  Result result2;
  @override
  void initState() {
    super.initState();
    final center = DarwinNotificationCenter();

    final stream1 = center.observe(name: 'testNotification');
    subscriptions.add(stream1.listen((result) {
      setState(() {
        this.result = result;
      });
    }));

    final stream2 = center.observe(
        name: 'testNotification2', behavior: Behavior.deliverImmediately);
    subscriptions.add(stream2.listen((result) {
      setState(() {
        result2 = result;
      });
    }));

    center.postNotification('testNotification',
        object: '1', deliverImmediately: false);

    center.postNotification('testNotification2', object: '1');
  }

  @override
  void dispose() {
    subscriptions.forEach((subscription) => subscription.cancel());
    subscriptions.clear();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: <Widget>[
            Text('Received native notification: ${result?.toString()} \n'),
            Text('Received native notification2: ${result2?.toString()} \n'),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_darwin_notification: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_darwin_notification/flutter_darwin_notification.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
44
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Android

Because:

  • package:flutter_darwin_notification/flutter_darwin_notification.dart that declares support for platforms: iOS, macOS

Package does not support Flutter platform Linux

Because:

  • package:flutter_darwin_notification/flutter_darwin_notification.dart that declares support for platforms: iOS, macOS

Package does not support Flutter platform Web

Because:

  • package:flutter_darwin_notification/flutter_darwin_notification.dart that declares support for platforms: iOS, macOS

Package does not support Flutter platform Windows

Because:

  • package:flutter_darwin_notification/flutter_darwin_notification.dart that declares support for platforms: iOS, macOS

Package not compatible with SDK dart

Because:

  • flutter_darwin_notification that is a package requiring null.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test