laravel_notify_fcm 0.0.3 copy "laravel_notify_fcm: ^0.0.3" to clipboard
laravel_notify_fcm: ^0.0.3 copied to clipboard

Laravel Notify for Firebase Cloud Messaging (FCM) - Send push notifications to your Flutter app from Laravel.

example/lib/main.dart

import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:laravel_notify_fcm/laravel_notify_fcm.dart';

void main() async {
  // Firebase.initializeApp();
  WidgetsFlutterBinding.ensureInitialized();
  FirebaseMessaging firebaseMessaging = FirebaseMessaging.instance;

  LaravelNotifyFcm.instance.init(
    firebaseMessaging: firebaseMessaging,
    url: "https://example.com/api/fcm",
    debugMode: true,
  );

  runApp(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: 'Laravel Notify FCM',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  // This is a simple example of how to use Media Pro.
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Laravel Notify Fcm")),
      body: SafeArea(
        child: Container(
          child: InkWell(
            child: Text("Enable notifications"),
            onTap: () async {
              // get your sanctum token from your Laravel app

              await LaravelNotifyFcm.storeFcmDevice(
                  sanctumToken: 'sanctumToken');
            },
          ),
        ),
      ),
    );
  }
}
2
likes
0
pub points
27%
popularity

Publisher

unverified uploader

Laravel Notify for Firebase Cloud Messaging (FCM) - Send push notifications to your Flutter app from Laravel.

Homepage
Repository (GitHub)
View/report issues

Topics

#laravel-fcm #push-notifications #laravel-push-notifications #fcm

Funding

Consider supporting this project:

github.com

License

unknown (license)

Dependencies

device_meta, dio, firebase_messaging, flutter, nylo_support, pretty_dio_logger

More

Packages that depend on laravel_notify_fcm