easy_push_notification 0.0.2 copy "easy_push_notification: ^0.0.2" to clipboard
easy_push_notification: ^0.0.2 copied to clipboard

A simple and efficient Flutter package to handle push notifications using Firebase Cloud Messaging (FCM) for both Android and iOS.

example/lib/main.dart

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:easy_push_notification/easy_push_notification.dart';

import 'firebase_options.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);

  EasyPush.I.initialize(EasyPushConfig());

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Easy Push')),

      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            // Print FCM token
            ElevatedButton(
              onPressed: () async {
                final token = await EasyPush.I.getToken();
                print(token);
              },
              child: Text("Get FCM"),
            ),

            ElevatedButton(
              onPressed: () async {
                EasyPush.I.showLocal(
                  title: 'Local Notification',
                  body: 'Local Notification',
                );
              },
              child: Text('Send Local Notification'),
            ),
          ],
        ),
      ),
    );
  }
}
3
likes
150
points
76
downloads

Publisher

unverified uploader

Weekly Downloads

A simple and efficient Flutter package to handle push notifications using Firebase Cloud Messaging (FCM) for both Android and iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

firebase_core, firebase_messaging, flutter, flutter_local_notifications, http, path_provider

More

Packages that depend on easy_push_notification