Fluxy
Fluxy Plugins

Notifications

Enterprise-grade notification system for Fluxy apps.

Notifications

Fluxy provides an industrial-grade notification system that handles channels, permissions, and scheduling with zero-config.

[GUIDE] Industrial Step-by-Step

1. Installation (via CLI)

Add the notifications module using the Fluxy CLI to maintain architectural integrity.

fluxy module add notifications

2. Managed Boot Sequence

Ensure your main.dart is configured with the mandatory three-step boot sequence.

import 'package:fluxy/fluxy.dart';
import 'core/registry/fluxy_registry.dart'; 

void main() async {
  await Fluxy.init();
  Fluxy.registerRegistry(() => registerFluxyPlugins()); 
  Fluxy.autoRegister(); // Boots notification listeners and channels
  runApp(MyApp());
}

3. Usage (Unified API)

Access the module through the stable Fx.platform gateway.

// Show immediate notification
Fx.platform.notifications.show(
  title: "New Message",
  body: "You have received a new update.",
);

// Schedule for later
Fx.platform.notifications.schedule(
  id: 1,
  title: "Reminder",
  body: "Time for your standup!",
  scheduledDate: DateTime.now().add(Duration(hours: 1)),
);

Core Functionality

1. Groups & Channels

Organize notifications into categories for better user control (Android).

Fx.platform.notifications.createChannel(
  id: "marketing",
  name: "Marketing Updates",
  importance: Importance.max,
);

2. Timezone Awareness

Notifications are timezone-aware by default, triggering at the correct local time even if the user travels.


The Wrong Way vs. The Right Way

Feature[WRONG] The Outdated Way[RIGHT] The Fluxy Standard
Plugin AccessFluxyPluginEngine.find<FluxyNotificationsPlugin>()Fx.platform.notifications
LogicManual boilerplate for channelsAuto-channeling via the platform API
SchedulingGuessing timezones for alertsNative timezone-aware scheduling
PermissionsCalling permission_handler directlyawait Fx.platform.notifications.requestPermission()

Pitfalls & Troubleshooting

1. "Scheduled notifications don't fire after reboot"

  • The Cause: Missing RECEIVE_BOOT_COMPLETED permission.
  • The Fix: Ensure your manifest includes the tags or let Fluxy CLI inject them.

2. "Notifications don't show on Android 13+"

  • The Cause: Not requesting POST_NOTIFICATIONS permission explicitly.
  • The Fix: Use requestPermission() before attempting to show any alerts.

3. "The app crashes when creating a channel"

  • The Cause: Duplicate channel IDs or invalid importance levels.
  • The Fix: Verify channel IDs are unique and use the Importance enum.

Best Practices

  1. Contextual Requests: Only ask for notification permissions when it makes sense (e.g., after an order).
  2. Clear Channels: Use descriptive names so users can choose what to disable.
  3. Payload Management: Use JSON payloads to route users to deep-linked screens on tap.

On this page