{"id":18928718,"url":"https://github.com/hamidhosen42/flutter-firebase","last_synced_at":"2025-06-21T16:35:49.453Z","repository":{"id":150277087,"uuid":"580091188","full_name":"hamidhosen42/Flutter-Firebase","owner":"hamidhosen42","description":"Firebase is a suite of tools and services for mobile and web app development provided by Google. It includes features such as real-time databases, authentication, and hosting.","archived":false,"fork":false,"pushed_at":"2023-06-17T14:21:02.000Z","size":22949,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T22:05:25.245Z","etag":null,"topics":["android","android-development","firebase","firebase-auth","firebase-cloud-messaging","firebase-database","firestore"],"latest_commit_sha":null,"homepage":"https://firebase.flutter.dev/docs/overview/","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hamidhosen42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-19T17:39:39.000Z","updated_at":"2025-02-27T10:38:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"6db60a0e-4a8d-492c-b9ea-c5458856267c","html_url":"https://github.com/hamidhosen42/Flutter-Firebase","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hamidhosen42/Flutter-Firebase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamidhosen42%2FFlutter-Firebase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamidhosen42%2FFlutter-Firebase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamidhosen42%2FFlutter-Firebase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamidhosen42%2FFlutter-Firebase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hamidhosen42","download_url":"https://codeload.github.com/hamidhosen42/Flutter-Firebase/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamidhosen42%2FFlutter-Firebase/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261159429,"owners_count":23118011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-development","firebase","firebase-auth","firebase-cloud-messaging","firebase-database","firestore"],"created_at":"2024-11-08T11:27:19.613Z","updated_at":"2025-06-21T16:35:44.435Z","avatar_url":"https://github.com/hamidhosen42.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"### [Firebase](https://console.firebase.google.com/u/0/project/flutter-firebase-1e704/authentication/users)\r\n\r\n### Screenshots\r\n\u003cimg src=\"./assets/1-splash_screen.png\" width=200\u003e \u003cimg src=\"./assets/2-account_option.png\" width=200\u003e \u003cimg src=\"./assets/3-create_account.png\" width=200\u003e \r\n\u003cimg src=\"./assets/4-phone_auth_screen.png\" width=200\u003e\u003cimg src=\"./assets/5-sign_in_screen.dart.png\" width=200\u003e \u003cimg src=\"./assets/6-forgot_screen.dart.png\" width=200\u003e \r\n\u003cimg src=\"./assets/7-otp_screen.png\" width=200\u003e \u003cimg src=\"./assets/8-real-time-data-screen.png\" width=200\u003e \u003cimg src=\"./assets/8.1-post_real_time_data.png\" width=200\u003e \r\n\u003cimg src=\"./assets/9-real-time-data-post-screen.png\" width=200\u003e \u003cimg src=\"./assets/10-real-time-data-update-screen.png\" width=200\u003e \u003cimg src=\"./assets/11-add-firestore-data.png\" width=200\u003e \u003cimg src=\"./assets/12-firestore_screen.png\" width=200\u003e \u003cimg src=\"./assets/13-firstore_update_screen.png\" width=200\u003e \u003cimg src=\"./assets/13-real-time-blog-screen.png\" width=200\u003e \u003cimg src=\"./assets/14-real-time-blog-upload.png\" width=200\u003e \r\n\r\n### [APK](https://github.com/hamidhosen42/Flutter-Firebase/blob/main/app-release.apk)\r\n### dependencies:\r\n1. firebase_core: ^1.10.0\r\n2. firebase_auth: ^3.2.0\r\n3. firebase_database: ^8.1.0\r\n4. cloud_firestore: ^3.1.0\r\n5. firebase_storage:\r\n6. flutter_loading_animation_kit: \r\n7. flutter_screenutil: \r\n8. fluttertoast: \r\n9. firebase_database: \r\n10.image_picker:\r\n\r\n### Topic :\r\n1. Firebase Integration in Flutter Project\r\n2. Firebase Authentication\r\n3. Cloud FireStore (CRUD)\r\n4. Real-Time Database (CRUD)\r\n5. Firebase Storage\r\n6. Push Notification\r\n\r\n#### Firebase Integration in Flutter Project:\r\nFirebase provides a wide range of services for mobile and web applications. To integrate Firebase into your Flutter project, you'll need to add the necessary Firebase packages as dependencies in your pubspec.yaml file. These packages include firebase_core (for initializing Firebase), firebase_auth (for authentication), cloud_firestore (for Cloud Firestore), and firebase_storage (for Firebase Storage). Additionally, you'll need to configure your project with the Firebase project credentials by adding the appropriate configuration files (google-services.json for Android and GoogleService-Info.plist for iOS) to the respective project directories.\r\n\r\n```\r\na. Set up a new Flutter project or open an existing project.\r\nb. Create a new Firebase project on the Firebase console (https://console.firebase.google.com/) and follow the on-screen instructions.\r\nc. Add the necessary Flutter Firebase dependencies to your pubspec.yaml file:\r\n\r\ndependencies:\r\n  firebase_core: ^1.6.0\r\n  firebase_auth: ^3.2.0\r\n  cloud_firestore: ^3.1.0\r\n  firebase_storage: ^10.2.0\r\n\r\nd. Run flutter pub get to fetch the dependencies.\r\ne. Configure your Flutter project with the Firebase project credentials by adding the google-services.json file (for Android) and the GoogleService-Info.plist file (for iOS) to the respective project directories.\r\nf. Initialize Firebase in your Flutter project by adding the following code in your main.dart file:\r\n\r\nimport 'package:firebase_core/firebase_core.dart';\r\n\r\nvoid main() async {\r\n  WidgetsFlutterBinding.ensureInitialized();\r\n  await Firebase.initializeApp();\r\n  runApp(MyApp());\r\n}\r\n```\r\n\r\n#### Firebase Authentication:\r\nFirebase Authentication provides various methods for user authentication, including email/password authentication, phone number authentication, and social media authentication (e.g., Google, Facebook, Twitter). You can choose the authentication methods that suit your app's requirements and implement them using the Firebase Authentication API. Firebase Authentication also offers features like user management, password reset, and account linking.\r\n\r\n```\r\na. Make sure you have integrated Firebase in your Flutter project (as mentioned in the previous steps).\r\nb. Add the firebase_auth dependency to your pubspec.yaml file (if you haven't already) and run flutter pub get.\r\nc. Use the Firebase Authentication API to implement the desired authentication flows in your app, such as email/password authentication, phone number authentication, social media authentication, etc.\r\n\r\nHere's an example of email/password authentication:\r\n\r\nimport 'package:firebase_auth/firebase_auth.dart';\r\n\r\n// Sign up with email and password\r\nvoid signUp(String email, String password) async {\r\n  try {\r\n    UserCredential userCredential = await FirebaseAuth.instance.createUserWithEmailAndPassword(\r\n      email: email,\r\n      password: password,\r\n    );\r\n    // User successfully signed up\r\n    User user = userCredential.user;\r\n    // ...\r\n  } catch (e) {\r\n    // Error occurred during sign up\r\n    print(e.toString());\r\n  }\r\n}\r\n\r\n// Sign in with email and password\r\nvoid signIn(String email, String password) async {\r\n  try {\r\n    UserCredential userCredential = await FirebaseAuth.instance.signInWithEmailAndPassword(\r\n      email: email,\r\n      password: password,\r\n    );\r\n    // User successfully signed in\r\n    User user = userCredential.user;\r\n    // ...\r\n  } catch (e) {\r\n    // Error occurred during sign in\r\n    print(e.toString());\r\n  }\r\n}\r\n\r\n// Sign out\r\nvoid signOut() async {\r\n  await FirebaseAuth.instance.signOut();\r\n}\r\n```\r\n\r\n#### Cloud Firestore (CRUD):\r\nCloud Firestore is a flexible, scalable, and real-time NoSQL database offered by Firebase. It organizes data into collections and documents. With Cloud Firestore, you can perform CRUD (Create, Read, Update, Delete) operations on your data. You can create a new document, read its data, update fields within a document, and delete documents. You can also query the database based on various criteria to retrieve specific data or perform complex searches.\r\n\r\n```\r\nCertainly! Cloud Firestore is a NoSQL document-oriented database provided by Firebase. It offers real-time data synchronization and offline capabilities, making it suitable for building responsive and collaborative applications. Here's a breakdown of CRUD operations in Cloud Firestore:\r\n\r\nCreate a Document:\r\nTo create a document in Cloud Firestore, you need to specify the collection where the document will reside and provide the data for the document. The document is identified by an automatically generated document ID or a custom ID you assign. Here's an example:\r\n\r\nimport 'package:cloud_firestore/cloud_firestore.dart';\r\n\r\nvoid createDocument() {\r\n  FirebaseFirestore.instance\r\n      .collection('users')\r\n      .doc('user1')\r\n      .set({\r\n        'name': 'John Doe',\r\n        'email': 'john@example.com',\r\n      })\r\n      .then((value) =\u003e print('Document created successfully'))\r\n      .catchError((error) =\u003e print('Failed to create document: $error'));\r\n}\r\n\r\n\r\nRead a Document:\r\nTo read a document from Cloud Firestore, you can retrieve it by specifying the collection and document ID. The data within the document can be accessed using the data() method. Here's an example:\r\n\r\nimport 'package:cloud_firestore/cloud_firestore.dart';\r\n\r\nvoid readDocument() {\r\n  FirebaseFirestore.instance\r\n      .collection('users')\r\n      .doc('user1')\r\n      .get()\r\n      .then((DocumentSnapshot documentSnapshot) {\r\n        if (documentSnapshot.exists) {\r\n          print(documentSnapshot.data());\r\n        } else {\r\n          print('Document does not exist');\r\n        }\r\n      })\r\n      .catchError((error) =\u003e print('Failed to read document: $error'));\r\n}\r\n\r\n\r\nUpdate a Document:\r\nTo update a document in Cloud Firestore, you can use the update() method to modify specific fields within the document. Here's an example:\r\n\r\nimport 'package:cloud_firestore/cloud_firestore.dart';\r\n\r\nvoid updateDocument() {\r\n  FirebaseFirestore.instance\r\n      .collection('users')\r\n      .doc('user1')\r\n      .update({'name': 'Jane Doe'})\r\n      .then((value) =\u003e print('Document updated successfully'))\r\n      .catchError((error) =\u003e print('Failed to update document: $error'));\r\n}\r\n\r\n\r\n\r\nDelete a Document:\r\nTo delete a document from Cloud Firestore, you can use the delete() method. Here's an example:\r\n\r\nimport 'package:cloud_firestore/cloud_firestore.dart';\r\n\r\nvoid deleteDocument() {\r\n  FirebaseFirestore.instance\r\n      .collection('users')\r\n      .doc('user1')\r\n      .delete()\r\n      .then((value) =\u003e print('Document deleted successfully'))\r\n      .catchError((error) =\u003e print('Failed to delete document: $error'));\r\n}\r\n\r\n```\r\n\r\n#### Real-Time Database (CRUD):\r\nFirebase Realtime Database is a NoSQL, cloud-hosted database that allows you to store and synchronize data in real-time across clients. It uses a JSON-like structure to store data. With the Realtime Database, you can perform CRUD operations by manipulating the database's references. You can create or update data, read data at a specific location, listen for real-time updates, and delete data. The Realtime Database is particularly useful for building real-time collaborative applications, chat apps, and other applications that require synchronized data.\r\n\r\n```\r\nReal-Time Database (CRUD):\r\nFirebase Realtime Database is a cloud-hosted NoSQL database that allows you to store and sync data in real-time. Here's an example of performing CRUD operations in the Realtime Database:\r\nimport 'package:firebase_database/firebase_database.dart';\r\n\r\n// Create or update data\r\nvoid setData() {\r\n  final databaseRef = FirebaseDatabase.instance.reference();\r\n  databaseRef.child('users/user1').set({\r\n    'name': 'John Doe',\r\n    'email': 'john@example.com',\r\n  });\r\n}\r\n\r\n// Read data\r\nvoid getData() {\r\n  final databaseRef = FirebaseDatabase.instance.reference();\r\n  databaseRef.child('users/user1').once().then((DataSnapshot snapshot) {\r\n    if (snapshot.value != null) {\r\n      print(snapshot.value);\r\n    }\r\n  });\r\n}\r\n\r\n// Update data\r\nvoid updateData() {\r\n  final databaseRef = FirebaseDatabase.instance.reference();\r\n  databaseRef.child('users/user1').update({\r\n    'name': 'Jane Doe',\r\n  });\r\n}\r\n\r\n// Delete data\r\nvoid deleteData() {\r\n  final databaseRef = FirebaseDatabase.instance.reference();\r\n  databaseRef.child('users/user1').remove();\r\n}\r\n\r\n\r\n```\r\n\r\n#### Firebase Storage:\r\nFirebase Storage provides secure file uploads and downloads for your app's user-generated content. It allows you to store various types of files, such as images, videos, audio files, and more. With Firebase Storage, you can upload files from the client-side and retrieve their download URLs for later use. You can also manage files, set access control rules, and monitor the upload/download progress.\r\n\r\n```\r\nFirebase Storage:\r\nFirebase Storage is a cloud storage solution provided by Firebase for storing and serving user-generated content. Here's an example of uploading and downloading files using Firebase Storage in Flutter:\r\n\r\nimport 'package:firebase_storage/firebase_storage.dart';\r\nimport 'package:path/path.dart' as Path;\r\n\r\n// Upload a file\r\nvoid uploadFile() async {\r\n  File file = File('path/to/file.jpg');\r\n  String fileName = Path.basename(file.path);\r\n  Reference storageRef = FirebaseStorage.instance.ref().child(fileName);\r\n  UploadTask uploadTask = storageRef.putFile(file);\r\n\r\n  await uploadTask.whenComplete(() =\u003e print('File uploaded'));\r\n}\r\n\r\n// Download a file\r\nvoid downloadFile() async {\r\n  String fileName = 'file.jpg';\r\n  Reference storageRef = FirebaseStorage.instance.ref().child(fileName);\r\n  String downloadURL = await storageRef.getDownloadURL();\r\n  // Use the downloadURL to download the file\r\n  // ...\r\n}\r\n\r\n```\r\n\r\n#### Push Notification:\r\nFirebase Cloud Messaging (FCM) enables you to send push notifications to your app users. Push notifications are a powerful tool for engaging users and delivering important updates. With FCM, you can send notifications to individual devices, groups of devices, or topics. You can customize the notification payload, handle notification actions, and even send data payloads along with notifications. FCM supports both Android and iOS platforms and provides reliable delivery of notifications to your app users.\r\n\r\n\r\n```\r\nPush Notification:\r\nFirebase Cloud Messaging (FCM) enables you to send push notifications to users of your Flutter app. Here's an example of sending a push notification using Firebase Cloud Messaging:\r\n\r\nimport 'package:firebase_messaging/firebase_messaging.dart';\r\n\r\n// Configure Firebase Cloud Messaging\r\nvoid configureFCM() {\r\n  FirebaseMessaging messaging = FirebaseMessaging.instance;\r\n  // Configure FCM settings, such as handling incoming messages, defining notification channels, etc.\r\n  // ...\r\n}\r\n\r\n// Send a push notification\r\nvoid sendPushNotification() async {\r\n  String serverToken = 'YOUR_SERVER_TOKEN';\r\n  String deviceToken = 'RECIPIENT_DEVICE_TOKEN';\r\n\r\n  await http.post(\r\n    Uri.parse('https://fcm.googleapis.com/fcm/send'),\r\n    headers: \u003cString, String\u003e{\r\n      'Content-Type': 'application/json',\r\n      'Authorization': 'key=$serverToken',\r\n    },\r\n    body: jsonEncode(\u003cString, dynamic\u003e{\r\n      'notification': \u003cString, dynamic\u003e{\r\n        'body': 'Hello, this is a push notification!',\r\n        'title': 'Flutter Firebase App',\r\n      },\r\n      'priority': 'high',\r\n      'data': \u003cString, dynamic\u003e{\r\n        'click_action': 'FLUTTER_NOTIFICATION_CLICK',\r\n        'id': '1',\r\n        'status': 'done',\r\n      },\r\n      'to': deviceToken,\r\n    }),\r\n  );\r\n}\r\n\r\n\r\n\r\n```\r\n\r\n### Real Time data base Permission denied in firbase:\r\n ```\r\n{\r\n  \"rules\": {\r\n    \".read\": true,\r\n    \".write\": true\r\n  }\r\n}\r\n ```\r\n\r\nSHA1 KeyWord commend =keytool -list -v -keystore C:\\Users\\user\\.android\\debug.keystore -alias androiddebugkey -storepass android -keypass android\r\n\r\nandroid-\u003eapp-\u003ebuild.grad=\r\n1. multiDexEnabled true\r\n2. implementation 'com.android.support:multidex:1.0.3'\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamidhosen42%2Fflutter-firebase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhamidhosen42%2Fflutter-firebase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamidhosen42%2Fflutter-firebase/lists"}