{"id":26751577,"url":"https://github.com/sayed3li97/flutter-firestore-crud","last_synced_at":"2025-04-15T00:18:24.107Z","repository":{"id":198676343,"uuid":"211876910","full_name":"sayed3li97/Flutter-Firestore-CRUD","owner":"sayed3li97","description":"A simple flutter app that preforms the basic create, retrieve, update and delete functionalities for Firebase Firestore","archived":false,"fork":false,"pushed_at":"2021-12-10T11:07:10.000Z","size":12369,"stargazers_count":23,"open_issues_count":0,"forks_count":13,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-15T00:18:12.926Z","etag":null,"topics":["android","firebase","firestore","flutter","ios"],"latest_commit_sha":null,"homepage":"","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/sayed3li97.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}},"created_at":"2019-09-30T14:17:17.000Z","updated_at":"2025-01-04T15:54:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"15c72642-a185-46e7-bab4-763fe3e88861","html_url":"https://github.com/sayed3li97/Flutter-Firestore-CRUD","commit_stats":null,"previous_names":["sayed3li97/flutter-firestore-crud"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FFlutter-Firestore-CRUD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FFlutter-Firestore-CRUD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FFlutter-Firestore-CRUD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayed3li97%2FFlutter-Firestore-CRUD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sayed3li97","download_url":"https://codeload.github.com/sayed3li97/Flutter-Firestore-CRUD/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248981251,"owners_count":21193148,"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","firebase","firestore","flutter","ios"],"created_at":"2025-03-28T12:18:43.999Z","updated_at":"2025-04-15T00:18:24.081Z","avatar_url":"https://github.com/sayed3li97.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flutter Firestore CRUD\n\nThis is a simple Flutter project that demonstrate all the CRUD functionality: \n\n- **Create** / **insert** from firestore\n- **Retrive** / **View** from firestore\n- **Update** / **Edit** from firestore\n- **Delete** / **Remove** from firestore\n\nThis source code is designed for beginners in Firebase Firestore, and it demonstrates the simplest way to the basic functionalities above.\n\n## Demo\n\n\u003cimg height=\"480px\" src=\"screenshots\\animatedscreenshot.gif\"\u003e\n\n## Screenshots\n\n\u003cimg height=\"380px\" src=\"screenshots\\Screenshot_1569803907.png\"\n     alt=\"Home Page\"\n     style=\"float: left; margin-right: 10px;\" /\u003e\n\u003cimg height=\"380px\" src=\"screenshots\\Screenshot_1569803932.png\"\n     alt=\"Add Page\"\n     style=\"float: left; margin-right: 10px; \" /\u003e\n\u003cimg height=\"380px\" src=\"screenshots\\Screenshot_1569803958.png\"\n     alt=\"Add Page\"\n     style=\"float: left; margin-right: 10px; \" /\u003e\n\u003cimg height=\"380px\" src=\"screenshots\\Screenshot_1569804024.png \"\n     alt=\"Update Page\"\n     style=\"float: left; margin-right: 10px;\" /\u003e\n\n\n# Getting Started\n\nTo get started with this project, you should do the following steps: \n1. Sign in/up to firebase \n2. Go to console \n3. Start a new project \n4. Create a Firestore database \n5. Create a \"books\" collection \n6. Add a new record with \"title\" and \"author\" fields    \n7. Download and input google-service.json to the correct location \n8. Run flutter pub get \n\n---\nIf you are new to flutter and firebase, check the video below to get more information on how to connect your flutter app with the firebase project. \n\n\n[![How to connect your flutter app with firebase project](https://img.youtube.com/vi/DqJ_KjFzL9I/0.jpg)](https://www.youtube.com/watch?v=DqJ_KjFzL9I)\n\n# Insert a row to Firestore (Create)\n\n```dart\nMap\u003cString, dynamic\u003e newBook = new Map\u003cString,dynamic\u003e();\n    newBook[\"title\"] = \"title value\";\n    newBook[\"author\"] = \"author value\";\n\nFirestore.instance\n        .collection(\"books\")\n        .add(newBook)\n        .whenComplete((){\n        // You can add your desire action after the row is added\n      } );\n```\n\n# Edit a row in firestore (Update)\n\nBasic Update function\n\n```dart\nMap\u003cString, dynamic\u003e updateBook = new Map\u003cString,dynamic\u003e();\n updateBook[\"title\"] = \"title value\";\n updateBook[\"author\"] = \"author value\";\n // Updae Firestore record information regular way\nFirestore.instance\n    .collection(\"books\")\n    .document(document.documentID)\n    .updateData(updateBook)\n    .whenComplete((){\n         // You can add your desire action after the row is updated \n});\n```\n\nOr update using a transaction. \n\n```dart\nMap\u003cString, dynamic\u003e updateBook = new Map\u003cString,dynamic\u003e();\n updateBook[\"title\"] = \"title value\";\n updateBook[\"author\"] = \"author value\";\nFirestore.instance.runTransaction((transaction) async {\n    await transaction.update(document.reference, updateBook)\n        .then((error){\n     // You can add your desire action after the row is updated \n    });\n  });\n},\n```\n\n# Delete a row in firestore (Delete)\n\n```dart\nFirestore.instance\n     .collection(\"books\")\n     .document(document.documentID) // Replace the document.documentID with the row id that you need to delete\n     .delete()\n     .catchError((e){\n   print(e);\n });\n\n```\n\n# View all the rows in a collection from firestore (Retrieve)\n\n```dart\n @override\n  Widget build(BuildContext context) {\n    return StreamBuilder\u003cQuerySnapshot\u003e(\n        stream: Firestore.instance.collection('books').snapshots(),\n        builder: (BuildContext context, AsyncSnapshot\u003cQuerySnapshot\u003e snapshot) {\n          if (snapshot.hasError)\n            return new Text('Error: ${snapshot.error}');\n          switch (snapshot.connectionState) {\n            case ConnectionState.waiting: return Center(child: CircularProgressIndicator(),);\n            default:\n              return new ListView(\n                padding: EdgeInsets.only(bottom: 80),\n                children: snapshot.data.documents.map((DocumentSnapshot document) {\n                  return Padding(\n                    padding: EdgeInsets.symmetric(vertical: 3, horizontal: 10),\n                    child: Card(\n                      child: ListTile(\n                        title: new Text(\"Title \" + document['title']),\n                        subtitle: new Text(\"Author \" + document['author']),\n                      ),\n                    ),\n                  );\n                }).toList(),\n              );\n          }\n        },\n      );\n  }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayed3li97%2Fflutter-firestore-crud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsayed3li97%2Fflutter-firestore-crud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayed3li97%2Fflutter-firestore-crud/lists"}