{"id":43584450,"url":"https://github.com/uchamod/flutter-bloc-learning","last_synced_at":"2026-02-04T00:13:10.740Z","repository":{"id":322503364,"uuid":"1080468447","full_name":"uchamod/flutter-bloc-learning","owner":"uchamod","description":"A repository to practice and learn Flutter BLoC state management - transitioning from Provider/Riverpod","archived":false,"fork":false,"pushed_at":"2025-11-04T20:04:03.000Z","size":272,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-11-04T21:20:46.914Z","etag":null,"topics":["bloc","blocpattern","cubit","dart","flutter","state-management"],"latest_commit_sha":null,"homepage":"","language":"C++","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/uchamod.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-21T12:16:34.000Z","updated_at":"2025-11-04T20:04:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/uchamod/flutter-bloc-learning","commit_stats":null,"previous_names":["uchamod/flutter-bloc-learning"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/uchamod/flutter-bloc-learning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uchamod%2Fflutter-bloc-learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uchamod%2Fflutter-bloc-learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uchamod%2Fflutter-bloc-learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uchamod%2Fflutter-bloc-learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uchamod","download_url":"https://codeload.github.com/uchamod/flutter-bloc-learning/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uchamod%2Fflutter-bloc-learning/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29062498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T23:14:54.203Z","status":"ssl_error","status_checked_at":"2026-02-03T23:14:50.873Z","response_time":96,"last_error":"SSL_read: 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":["bloc","blocpattern","cubit","dart","flutter","state-management"],"created_at":"2026-02-04T00:13:09.956Z","updated_at":"2026-02-04T00:13:10.734Z","avatar_url":"https://github.com/uchamod.png","language":"C++","readme":"# 🚀 Flutter BLoC Architecture Example\n\nThis repository demonstrates the **BLoC (Business Logic Component)** architecture pattern in Flutter using the official **`flutter_bloc`** package.  \nIt showcases both **Cubit** and **Bloc** implementations to help developers understand the difference between them and how to apply each effectively.\n\n---\n\n## 🧠 Overview\n\nThe **BLoC pattern** is a predictable state management solution that separates business logic from the presentation layer.  \nBy organizing your Flutter app using BLoC, you ensure a **scalable**, **maintainable**, and **testable** codebase.\n\nThis repository illustrates:\n- How **Cubit** provides a simplified way to handle state.\n- How **Bloc** adds an event-driven layer for more structured logic handling.\n- The key differences, use cases, and advantages of both.\n\n---\n\n## 🧩 Architecture Summary\n\nThe app structure follows the **BLoC architecture** pattern:\n\n\n- **Presentation Layer**: Flutter widgets that rebuild when the state changes.\n- **BLoC / Cubit Layer**: Contains the core business logic, transforming user input or events into new application states.\n- **Repository Layer**: Handles data fetching, caching, or database access.\n- **Data Source Layer**: Connects to APIs, Firebase, or local data sources.\n\n---\n\n## ⚡ Cubit\n\n**Cubit** is a lightweight and straightforward state management solution that emits new states through direct method calls.  \nIt is best suited for simple logic such as counters, toggles, or theme switching.\n\n**Key Characteristics:**\n- Simple to implement.\n- Minimal boilerplate.\n- Direct method calls instead of events.\n- Emits new states directly.\n\n**Best For:** Small features and local UI state updates.\n\n---\n\n## ⚙️ Bloc\n\n**Bloc** extends Cubit by introducing the concept of **events**.  \nEach user interaction or trigger is represented as an event, and the Bloc maps these events to states using event handlers.\n\n**Key Characteristics:**\n- Event-driven architecture.\n- Clear separation between events and states.\n- Scalable for complex features.\n- Better suited for handling asynchronous operations such as API calls.\n\n**Best For:** Complex workflows, data fetching, authentication, and form validation.\n\n---\n\n## 🧱 Folder Structure\n\nThe repository is organized for clarity and modularity:\n\n\nThis separation makes it easy to see how each approach handles state differently while following the same architectural principles.\n\n---\n\n## 💡 Key Features\n\n- 🔹 Clear separation between business logic and UI\n- 🔹 Implementation of both **Cubit** and **Bloc** approaches\n- 🔹 Reactive UI updates through state streams\n- 🔹 Reusable and testable logic components\n- 🔹 Demonstrates event-to-state mapping in Bloc\n- 🔹 Easy scalability for large Flutter applications\n\n---\n\n## 🧭 When to Use What\n\n| Use Case | Recommended |\n|-----------|--------------|\n| Simple state changes | 🟢 **Cubit** |\n| Multiple user actions or async flows | 🟣 **Bloc** |\n| Beginners learning state management | 🧩 **Start with Cubit** |\n| Production-grade apps with complex logic | ⚙️ **Bloc** |\n\n---\n\n## 🧪 Testing \u0026 Scalability\n\nBoth Cubit and Bloc are fully testable:\n- You can test emitted states without UI dependencies.\n- The clear logic separation allows integration and unit testing at all levels.\n\nAs your app grows, you can easily transition from Cubit to Bloc for more complex workflows without rewriting your entire architecture.\n\n---\n\n## 🚀 Getting Started\n\n1. Clone the repository.\n2. Run `flutter pub get` to install dependencies.\n3. Open the project in your IDE.\n4. Explore the **Cubit** and **Bloc** examples to understand their behavior.\n\n---\n\n## 🧠 Learning Resources\n\n- [Bloc Documentation](https://bloclibrary.dev)\n- [Flutter Bloc Package on pub.dev](https://pub.dev/packages/flutter_bloc)\n- [Bloc Architecture Overview (bloclibrary.dev)](https://bloclibrary.dev/#/architecture)\n\n---\n\n## 👨‍💻 Author\n\n**Your Name**  \nFlutter Developer | Mobile App Architect  \n🌐 [Portfolio](#) • 💼 [LinkedIn](#) • 🐙 [GitHub](#)\n\n---\n\n## 📝 License\n\nThis project is licensed under the **MIT License**.  \nSee the [LICENSE](LICENSE) file for details.\n\n---\n\n### 💬 Final Note\n\n\u003e The BLoC pattern provides structure and predictability to Flutter apps.  \n\u003e Start simple with **Cubit**, scale up with **Bloc**, and maintain clean, testable code as your project grows.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuchamod%2Fflutter-bloc-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuchamod%2Fflutter-bloc-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuchamod%2Fflutter-bloc-learning/lists"}