notibee 1.1.0 copy "notibee: ^1.1.0" to clipboard
notibee: ^1.1.0 copied to clipboard

NotiBee — One package. All notifications. Handle Local, Push (FCM), and In-App Notifications in Flutter.

NotiBee 🐝 #

"NotiBee — One package. All notifications."

notibee wraps flutter_local_notifications, firebase_messaging, and firebase_in_app_messaging into a single, beginner-friendly API. Handle local, push, and in-app notifications with just a few lines of code.

✨ Features #

  • Zero-Dependency Core: Lightweight and robust native implementation (Kotlin & Swift).
  • 🚀 One-Line Initialization: No boiler-plate code.
  • 📬 Local Notifications: Show instant, scheduled, or repeating notifications.
  • 🌩️ Push Notifications: Integrated Firebase Cloud Messaging (FCM) support.
  • 💬 In-App Messaging: Display banners and popups via Firebase.
  • 🎨 Custom Assets: Easily use custom icons and sounds.
  • 👆 Interactive: Add action buttons with callbacks.

📦 Installation #

Add to your pubspec.yaml:

dependencies:
  notibee: ^1.1.0

🛠️ Setup #

1. Initialize #

Call NotiBee.init in your main() function.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await NotiBee.init(
    appName: "My App",
    defaultIcon: NotifyIcon.app,      // Default: @mipmap/ic_launcher
    defaultSound: NotifySound.system, // Default: System sound
    usePushNotifications: true,       // Enable FCM (Optional)
    useInAppMessaging: true,          // Enable In-App Messaging (Optional)
  );

  runApp(const MyApp());
}

2. Android Setup (Custom Assets) #

  • Icon: Place a transparent PNG in android/app/src/main/res/drawable/.
  • Sound: Place audio files (wav/mp3) in android/app/src/main/res/raw/.

3. Firebase Setup (If using Push/In-App) #

  • Android: Download google-services.json and place it in android/app/.
  • iOS: Download GoogleService-Info.plist and place it in ios/Runner/.

💻 Usage #

Local Notifications #

Show Instantly:

NotiBee.show(
  title: 'Hello!',
  body: 'This is an instant notification.',
  icon: NotifyIcon.custom('my_icon'), // Filename in drawable
  sound: NotifySound.custom('my_sound'), // Filename in raw
);

Schedule for Later:

NotiBee.schedule(
  title: 'Reminder',
  body: 'This appears after 5 seconds',
  after: const Duration(seconds: 5),
);

Repeat:

NotiBee.repeat(
  title: 'Water Reminder',
  body: 'Time to drink water!',
  interval: NotifyInterval.hourly,
);

With Action Buttons:

// 1. Setup Listener
NotiBee.onAction((actionId) {
  print("User clicked: $actionId");
});

// 2. Show
NotiBee.show(
  title: 'Update Available',
  body: 'Do you want to update now?',
  actions: [
    NotifyAction(id: 'yes', label: 'Update Now'),
    NotifyAction(id: 'no', label: 'Later'),
  ],
);

Push Notifications (FCM) #

Get Token:

String? token = await NotiBee.getFCMToken();
print("FCM Token: $token");

Use this token in Firebase Console to test notifications.

Background Handling: The package automatically handles background messages.

  • Foreground: Shows a local notification using your default/custom settings.
  • Background/Terminated: Messages appear in the system tray.

In-App Messaging #

Trigger Programmatically: You can trigger in-app campaigns using events.

NotiBee.triggerInAppEvent('level_up');

Create a campaign in Firebase Console with "level_up" as the trigger.

❓ Troubleshooting #

Icon is a white square? Android notification icons must be transparent (silhouette). Avoid solid backgrounds.

Sound not playing? Android Notification Channels are immutable. If you changed the sound file but kept the same code, the old setting persists.

  • Fix: uninstall and reinstall the app, or use NotifySound.custom('new_name') to force a new channel creation.

📄 License #

MIT

2
likes
160
points
15
downloads

Publisher

unverified uploader

Weekly Downloads

NotiBee — One package. All notifications. Handle Local, Push (FCM), and In-App Notifications in Flutter.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

firebase_core, firebase_in_app_messaging, firebase_messaging, flutter

More

Packages that depend on notibee

Packages that implement notibee