notification_history 1.0.1
notification_history: ^1.0.1 copied to clipboard
A Flutter package to manage and display the history of notifications received by the app, including Firebase Cloud Messaging (FCM) notifications.This package provides a local database to store notific [...]
Notification History #
A Flutter package for managing and displaying push notification history using Firebase Cloud Messaging (FCM) and local notifications.
Features #
Store notifications in a local SQLite database. Display notification history with read/unread status. Support for FCM and local notifications. Clean architecture with dependency injection using get_it.
Installation #
-
Add the package to your pubspec.yaml: dependencies: notification_history: path: /path/to/notification_history # For local development
Or use: git: https://github.com/yourusername/notification_history.git #
Or use: version: ^1.0.0 (after publishing to pub.dev) #
-
Run flutter pub get. Setup
-
Configure Firebase:
Add google-services.json to android/app/ and GoogleService-Info.plist to ios/Runner/. Initialize Firebase in your app:await Firebase.initializeApp();
- Set Up Dependency Injection: import 'package:get_it/get_it.dart'; import 'package:notification_history/notification_history.dart';
final getIt = GetIt.instance;
void setupDI() { getIt.registerSingleton
-
Initialize Notifications: void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); setupDI(); await getIt
-
Display Notification History: Navigator.push( context, MaterialPageRoute( builder: (context) => NotificationHistoryScreen( getNotifications: getIt
-
Show a Local Notification: getIt
-
Android Configuration
Add to android/app/src/main/AndroidManifest.xml:<application ...>
Add to android/app/src/main/res/values/strings.xml:
- iOS Configuration
Enable Push Notifications in Xcode. Add GoogleService-Info.plist to ios/Runner/.
Example #
See the example/ directory for a sample app.
License #
MIT License