NotificationType enum

A simplified notification system for Flutter

This API provides a clean, simple way to show notifications with full control over their content and behavior.

Usage

  1. Wrap your app with NotificationProvider:
NotificationProvider(
  child: MyApp(),
)
  1. Show notifications using showNotificationWithContext (recommended):
var notification = showNotificationWithContext(
  context: context,
  data: NotificationData(
    title: "Super Notification",
    body: "This is a test notification",
    type: NotificationType.info,
  ),
  priority: NotificationPriority.high,
  alignment: Alignment.bottomCenter,
  builder: (context, data, notification) => ListTile(
    title: Text(data.title ?? 'No title'),
    subtitle: Text(data.body ?? 'No body'),
    trailing: IconButton(
      icon: Icon(Icons.close),
      onPressed: () => notification.close(),
    ),
  ),
);
  1. Control the notification:
notification.replace(Text("Replaced content"));
notification.close();

Features

  • Simple API: Just one function to show notifications
  • Full Control: Replace content, close, and manage notifications
  • Flexible Positioning: Choose any alignment
  • Custom Widgets: Build any widget you want
  • Direct Data Access: Access notification data directly in the builder
  • Direct Instance Access: The notification instance is passed to the builder
  • Smooth Animations: Built-in slide and fade animations

Example with Progress

var progressNotifier = ValueNotifier<double>(0.0);

var notification = showNotificationWithContext(
  context: context,
  data: NotificationData(title: "Upload Progress"),
  builder: (context, data, notification) => Column(
    children: [
      Text(data.title ?? ''),
      ValueListenableBuilder<double>(
        valueListenable: progressNotifier,
        builder: (context, progress, child) => LinearProgressIndicator(value: progress),
      ),
      IconButton(
        icon: Icon(Icons.close),
        onPressed: () => notification.close(),
      ),
    ],
  ),
);

// Update progress
progressNotifier.value = 0.5;

Types of notifications

Inheritance
Available extensions

Values

info → const NotificationType
warning → const NotificationType
error → const NotificationType

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

values → const List<NotificationType>
A constant List of the values in this enum, in order of their declaration.