FCMService (notifications/fcm_service.dart)

opensource-ecommerce-mobile-app · lib/core/notifications/fcm_service.dart · dart · MIT
voice, chat

Service handling Firebase Cloud Messaging for Flutter apps, including permissions and local notifications.

// Source: https://github.com/bagisto/opensource-ecommerce-mobile-app | License: MIT | Copyright 2026 Webkul Software Private Limited
// Provided via justclaw.it.com; keep this notice with the code.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'device_token_service.dart';

/// iOS-specific retry configuration
const int _iosTokenRetryAttempts = 5;
const Duration _iosTokenRetryDelay = Duration(seconds: 2);

/// Callback type for notification handling
typedef NotificationCallback = Future<void> Function(RemoteMessage message);

/// Callback type for local notification tap handling
typedef L

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key