{"id":18140769,"url":"https://github.com/abdulawalarif/network_request_with_bloc","last_synced_at":"2026-02-14T05:07:04.785Z","repository":{"id":259286604,"uuid":"877097814","full_name":"abdulawalarif/network_request_with_bloc","owner":"abdulawalarif","description":"This Flutter and Dart boilerplate project is for managing the state with the bloc and writing dependency injectable code for sending network requests. ","archived":false,"fork":false,"pushed_at":"2024-10-24T20:23:29.000Z","size":44431,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T21:40:29.699Z","etag":null,"topics":["android","apps","bloc","clean-architecture","dart","dependency-injection","flutter","flutter-apps","flutter-examples","ios","mobile","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abdulawalarif.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-23T04:47:09.000Z","updated_at":"2024-11-16T19:12:17.000Z","dependencies_parsed_at":"2024-10-24T04:39:19.460Z","dependency_job_id":"41cf10e8-c61a-4993-83e0-1cd1cd1dc7ed","html_url":"https://github.com/abdulawalarif/network_request_with_bloc","commit_stats":null,"previous_names":["abdulawalarif/network_request_with_bloc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abdulawalarif/network_request_with_bloc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdulawalarif%2Fnetwork_request_with_bloc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdulawalarif%2Fnetwork_request_with_bloc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdulawalarif%2Fnetwork_request_with_bloc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdulawalarif%2Fnetwork_request_with_bloc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abdulawalarif","download_url":"https://codeload.github.com/abdulawalarif/network_request_with_bloc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdulawalarif%2Fnetwork_request_with_bloc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29437368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T03:34:37.767Z","status":"ssl_error","status_checked_at":"2026-02-14T03:34:09.092Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","apps","bloc","clean-architecture","dart","dependency-injection","flutter","flutter-apps","flutter-examples","ios","mobile","rest-api"],"created_at":"2024-11-01T16:06:51.488Z","updated_at":"2026-02-14T05:07:04.751Z","avatar_url":"https://github.com/abdulawalarif.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Network Request with Bloc\n\n## This Flutter and Dart project demonstrates how to send network requests using the Bloc library. Here I fetched data from two different API endpoints and displays is on a list, This stracture also optimized performance through caching to prevent double network call.\n\n**The project provides a solid foundation for developers looking to implement network-based features in their applications using Flutter’s Bloc architecture. It includes features like data loading from multiple sources, caching of responses, and efficient UI updates when data changes.**\n\n\n\n## Features\n* **Data Fetching with Bloc:** The app loads data from APIs, showcasing how to integrate network requests within the Bloc architecture for state management.\n* **Caching Mechanism:** Caching is used to store the fetched data, ensuring that subsequent requests for the same data are served from memory, avoiding additional network calls and improving performance.\n* **Dynamic Data Sources:** You can switch between two JSON endpoints by interacting with the app, demonstrating how multiple APIs can be handled within the same Bloc.\n* **Real-Time UI Updates:** As the data is fetched and processed, the UI is updated in real-time to display the list of persons (name and age) in a clean, simple interface.\n\n## File stracture\n\n    \n    ├── lib\n    │   ├── bloc  \n    │   │  ├── bloc_actions # Actions are sent from the UI \n    │   │  ├── posts_bloc  # Produce result for Posts to UI\n    │   │  ├── users_bloc  # result for users\n    │   │── models\n    │   │   ├── post_model\n    │   │   ├── user_model\n    │   ├── main.dart                  \n     \n \n\n \n \u003cimg src=\"demo/bloc.gif\" width=\"50%\" alt=\"Demo of this application\" /\u003e\n\n\n \n\n## Run Locally\n\nClone the project\n\n```bash\n  git clone https://github.com/abdulawalarif/network_request_with_bloc.git\n```\n\nGo to the project directory\n\n```bash\n  cd network_request_with_bloc\n```\n\nInstall dependencies\n\n```bash\n  flutter pub get\n```\n\nConnect a physical device or start a virtual device on your machine\n\n```bash\n  flutter run\n```\n\n\n\n## How to tweak this project for your own uses\n* **Change the API URLs:** Replace the example API endpoints (loadAllUsers, loadAllPosts) with your own REST API or local JSON files.\n\n* **Modify the Data Model:** If your API returns a different structure, adjust the Person class to correctly parse your JSON responses.\n* **Enhance the UI:** You can improve the UI by adding more fields to display or by using custom widgets to make the app more visually appealing.\n\n* **Expand the Caching Strategy:** The caching mechanism in the PersonsBloc could be enhanced by adding expiration times, offline storage, or more complex caching strategies for larger datasets.\n\n \n\n## Reporting Bugs or Requesting Features?\n\nIf you found an issue or would like to submit an improvement to this project,\nplease submit an issue using the issues tab above. If you would like to submit a PR with a fix, reference the issue you created!\n\n##  Known Issues and Future Work\n* **Lazy Loading:** Future improvements could include adding lazy loading to handle larger datasets more efficiently without freezing the UI.\n* **Advanced Caching:** While the current caching mechanism works for small datasets, it can be expanded for more complex use cases, such as persisting data locally or handling cache expiration.\n* **Improved Error Handling:** The current implementation focuses on successful responses. Implementing comprehensive error handling for failed network requests would make the app more robust.\n\n\n## Author\n\n- [@abdulawalarif](https://github.com/abdulawalarif)\n  \n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdulawalarif%2Fnetwork_request_with_bloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabdulawalarif%2Fnetwork_request_with_bloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdulawalarif%2Fnetwork_request_with_bloc/lists"}