custom_firebase_services 0.0.3
custom_firebase_services: ^0.0.3 copied to clipboard
A Flutter package for Firebase services including authentication, notifications, media uploads, and chat features. Simplifies common Firebase operations with clean, reusable APIs.
example/lib/main.dart
import 'package:custom_firebase_services/custom_firebase_services.dart';
import 'package:example/home_screen.dart';
import 'package:example/second_page.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
MyApp({super.key});
final MediaUploadService storageService = MediaUploadService();
// final ChatService chatService = ChatService();
@override
Widget build(BuildContext context) {
final config= FirebaseNotificationConfig(
projectId: '---ADD PROJECT ID---',
senderId: '---ADD SENDER ID---',
serviceAccountJson: {
/// add service account here
},
onNotificationTap: (payLoad){
print('payLoad is $payLoad');
if(payLoad['screen']=='second'){
print('payLoad iss second');
navigatorKey.currentState?.push(
MaterialPageRoute(builder: (_) => SecondPage()),
); }else{
print('payLoad is not second');
}
}
);
print('Firebase config::::::::::::::::::::::::::::::::::::::::::');
FirebaseSendNotificationService.initialize(config);
FirebasePushNotificationService.initialize(config);
FirebasePushNotificationService().getToken();
return MaterialApp(
navigatorKey: navigatorKey,
home: HomeScreen(),
);
}
}