<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mayur Pawar</title>
    <description>The latest articles on DEV Community by Mayur Pawar (@mayur_pawar_8b6c0658c55fd).</description>
    <link>https://dev.to/mayur_pawar_8b6c0658c55fd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2139158%2F3d152300-decf-42c7-b940-5631a62401b1.png</url>
      <title>DEV Community: Mayur Pawar</title>
      <link>https://dev.to/mayur_pawar_8b6c0658c55fd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mayur_pawar_8b6c0658c55fd"/>
    <language>en</language>
    <item>
      <title>🚀 How I Added Local Notifications in Flutter Without Firebase</title>
      <dc:creator>Mayur Pawar</dc:creator>
      <pubDate>Wed, 02 Jul 2025 19:10:13 +0000</pubDate>
      <link>https://dev.to/mayur_pawar_8b6c0658c55fd/how-i-added-local-notifications-in-flutter-without-firebase-2bpn</link>
      <guid>https://dev.to/mayur_pawar_8b6c0658c55fd/how-i-added-local-notifications-in-flutter-without-firebase-2bpn</guid>
      <description>&lt;p&gt;Most developers reach for Firebase when they think of notifications in Flutter. But what if your app needs to work offline and you just want to send a reminder, alarm, or alert without setting up a full backend?&lt;/p&gt;

&lt;p&gt;In this post, I’ll show you how I implemented local notifications using the flutter_local_notifications package — with zero Firebase and full offline support!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔧 What I Used&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;flutter_local_notifications&lt;/li&gt;
&lt;li&gt;permission_handler (for Android 13+ permission)&lt;/li&gt;
&lt;li&gt;A basic Flutter project&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🎥 Demo
&lt;/h3&gt;

&lt;p&gt;Here's how it looks in action:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fln25v2910v2by9y66aiq.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fln25v2910v2by9y66aiq.gif" alt="flutter_local_notification" width="760" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧱 Step-by-Step Implementation&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add dependencies in pubspec.yaml
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dependencies:
  flutter:
    sdk: flutter
  flutter_local_notifications: ^17.0.0
  permission_handler: ^11.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Request Notification Permission (Android 13+)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:permission_handler/permission_handler.dart';

void requestNotificationPermission() async {
  if (await Permission.notification.isDenied) {
    await Permission.notification.request();
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, add this in AndroidManifest.xml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;uses-permission android:name="android.permission.POST_NOTIFICATIONS"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Initialize the Plugin in main.dart
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();

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

  const AndroidInitializationSettings initializationSettingsAndroid =
      AndroidInitializationSettings('@mipmap/ic_launcher');

  const InitializationSettings initializationSettings =
      InitializationSettings(android: initializationSettingsAndroid);

  await flutterLocalNotificationsPlugin.initialize(initializationSettings);

  requestNotificationPermission(); // Ask at startup

  runApp(MyApp());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Show a Simple Notification
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ElevatedButton(
          onPressed: () {
            flutterLocalNotificationsPlugin.show(
              0,
              'Linkedin',
              'New jobs for "application developer"',
              NotificationDetails(
                android: AndroidNotificationDetails(
                  "channelId",
                  "localNotification",
                  importance: Importance.max,
                  priority: Priority.high,
                ),
              ),
            );
          },
          child: Text('local notification'),
        )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Fix: Enable Core Library Desugaring&lt;br&gt;
Follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enable desugaring in build.gradle (app-level):
Open your android/app/build.gradle file and do the following:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Step 1: Add this in android {} block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8

    // Enable desugaring
   isCoreLibraryDesugaringEnabled = true 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2: Add the desugaring dependency in dependencies {}:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dependencies {
    coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Sync and Rebuild:
Run flutter clean&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then run flutter pub get&lt;/p&gt;

&lt;p&gt;Finally, build again:&lt;br&gt;
flutter run or use Android Studio’s run button&lt;/p&gt;

&lt;p&gt;✅ Bonus Tips&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use @mipmap/ic_launcher or a valid drawable icon — not from assets/.&lt;/li&gt;
&lt;li&gt;You can schedule notifications too using zonedSchedule().&lt;/li&gt;
&lt;li&gt;Works completely offline, perfect for reminders, alarms, and daily alerts!&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>android</category>
      <category>mobile</category>
    </item>
  </channel>
</rss>
