notification_project_flutter 0.0.2 copy "notification_project_flutter: ^0.0.2" to clipboard
notification_project_flutter: ^0.0.2 copied to clipboard

A Flutter plugin for handling notifications across iOS and Android platforms with enhanced security.

Notification Project Flutter Plugin #

A Flutter plugin that provides a unified interface for handling notifications across iOS and Android platforms. This plugin wraps the native Notification Project SDKs for both platforms.

Features #

  • πŸ”” Cross-platform notification support
  • 🎯 Unified API for iOS and Android
  • ⚑ Action handling for notifications
  • 🎨 Customizable notification styles
  • πŸ”„ Automatic retry mechanism
  • πŸ“± Device information management
  • πŸ”’ Secure token management
  • πŸ“Š Analytics and tracking
  • 🌐 Multi-language support

Requirements #

  • Flutter 3.0.0 or higher
  • Dart 2.17.0 or higher
  • iOS 13.0 or higher
  • Android 5.0 (API level 21) or higher

Installation #

Add the plugin to your pubspec.yaml file:

dependencies:
  notification_project_flutter:
    git:
      url: https://github.com/yourusername/notification-project-flutter.git
      ref: main  # or specific version tag

Then run:

flutter pub get

Usage #

Initialize the Plugin #

import 'package:notification_project_flutter/notification_project_flutter.dart';

// Initialize the plugin with your API key
await NotificationProjectFlutter.initialize(
  apiKey: 'YOUR_API_KEY',
);

// Set up notification listener
NotificationProjectFlutter.setListener(
  onNotificationReceived: (notification) {
    // Handle received notification
  },
  onNotificationAction: (actionId, messageId) {
    // Handle notification action
  },
  onNotificationError: (error) {
    // Handle errors
  },
);

Send a Notification #

final notification = Notification(
  id: 'unique_id',
  title: 'Notification Title',
  body: 'Notification Body',
  data: {'key': 'value'},
  style: NotificationStyle(
    type: 'default',
    backgroundColor: '#FFFFFF',
    textColor: '#000000',
  ),
  actions: [
    NotificationAction(
      id: 'action_1',
      title: 'Action 1',
    ),
  ],
);

await NotificationProjectFlutter.sendNotification(notification);

Handle Notification Actions #

// Actions are automatically handled through the listener
// You can also manually trigger actions:
await NotificationProjectFlutter.onActionReceived(
  actionId: 'action_id',
  messageId: 'message_id',
);

API Reference #

NotificationProjectFlutter #

Main class for plugin operations.

Methods

  • initialize(apiKey: String): Initialize the plugin
  • setListener({onNotificationReceived, onNotificationAction, onNotificationError}): Set notification listener
  • sendNotification(notification: Notification): Send a notification
  • onActionReceived(actionId: String, messageId: String): Handle notification action
  • getDeviceToken(): Get the current device token
  • updateUserProperties(Map<String, dynamic> properties): Update user properties

Models #

Notification

class Notification {
  final String id;
  final String title;
  final String body;
  final Map<String, dynamic> data;
  final NotificationStyle style;
  final List<NotificationAction> actions;
}

NotificationStyle

class NotificationStyle {
  final String type;
  final String backgroundColor;
  final String textColor;
}

NotificationAction

class NotificationAction {
  final String id;
  final String title;
}

Platform Setup #

iOS #

Add the following to your ios/Runner/Info.plist:

<key>UIBackgroundModes</key>
<array>
    <string>remote-notification</string>
</array>

Android #

Add the following to your android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

Contributing #

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License #

This project is licensed under the MIT License - see the LICENSE file for details.

0
likes
120
points
33
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for handling notifications across iOS and Android platforms with enhanced security.

Repository (GitHub)

Documentation

API reference

License

unknown (license)

Dependencies

crypto, firebase_core, firebase_messaging, flutter, flutter_secure_storage, http, local_auth, plugin_platform_interface

More

Packages that depend on notification_project_flutter

Packages that implement notification_project_flutter