πŸš€ User management app built in flutter using clean architecture, MVVM, get it, dio, RxDart, bloc, cubit, getX and provider

Overview

πŸ”₯ Go Rest app

In this project, we are going to build a user management app using Flutter. We have used the Go REST API to make HTTP request methods. This API provides all sorts of methods that we need: GET, POST, PUT, and DELETE. We will call all endpoints (users/todos/posts/comments) provided to us by the Go REST API using the Dio package in our app. We have performed different operations like selecting, adding, editing, and removing users, as well as user posts, todos, and comments.


πŸ–Ό Screenshots

User screen Create-update User Todo screen Post screen
Date picker Time picker Create-update post Comment Screen
Error state Empty state Warning dialog Progress dialog

🧩 Entity Relationship Diagram (ERD)

πŸš€ Features

  • Different implementations with separate modules based on state management solutions and software architectures

  • Clean architecture / MVVM architecture / simple layered architecture

  • Feature-first and Layer-first approach

  • Performing CRUD operation using Dio and go rest api

  • Converting JSON string to an equivalent dart object and vice versa with json serializable

  • Implementing Interceptors, Global configuration and timeout for api calls

  • Exception Handling with Dio interceptor, Dartz and freezed

  • Dependency injection with get it (Clean architecture / MVVM architecture version)

  • Displaying error type to the user through the alert dialogs

  • Colorize api info like request, response, body and exceptions in Debug console log

  • Read, create, update and delete user

  • Filter users by status activity or gender

  • Read, create, update and delete user todos

  • Filter todos by status

  • Read, create, update and delete user posts

  • Display, create and delete user comments for each post

  • Get date/time from user by Date/Time picker

  • Generic structure

  • State management with GetX | Bloc | Cubit | RxDart


🀝 Feature-first (Package-by-feature) and Layer-first (Package-by-layer)

In this repository two architectural approaches have been used. Feature-first (for clean architecture and simple layered architecture version) and Layer-first (for mvvm architecture version).

The feature-first approach demands that we create a new folder for every new feature that we add to our app. And inside that, we add the layers themselves as sub-folders. But in Layer-first approach, we add all the relevant files inside each feature folder, ensuring that they belong to the correct layer.


❗️ Api limitation

β€’ The user endpoint contains ten user objects by default. If any of them are deleted, they will be replaced with a new JSON object. This means that the length of the user list will always be ten, and it is not possible to create more than ten user objects. This also applies if you want to add query parameters to the users.

β€’ To use the request methods PUT, POST, PATCH, and DELETE, you need to provide an access token. This token must be passed with the "Authorization" header as a Bearer token. I have already included my own token in the app. However, if you receive an Unauthorized Error (401), please go to this link to obtain a new token and replace the old token in the api_config file located in the core directory.

β€’ Please note that the data is not permanent and will be changed or deleted every 20 minutes to 1 hour.


πŸ—‚ Modules

Version Bloc Cubit Getx RxDart + Provider
Clean architecture version Source️ Source Source Source
MVVM architecture version Source Source️ Source️
Simple layered architecture version Source Source Source

πŸ“š Dependencies (Clean architecture version (Feature-first))

Name GetX Cubit Bloc RxDart + Provider
flutter_bloc βœ–οΈ βœ” βœ” βœ–
provider βœ–οΈ βœ– βœ– βœ”
rxdart βœ–οΈ βœ– βœ– βœ”
get_it βœ”οΈ βœ” βœ” βœ”
GetX βœ”οΈ βœ–οΈ βœ–οΈ βœ–
dio βœ”οΈ βœ”οΈ βœ”οΈ βœ”
freezed βœ–οΈ βœ”οΈ βœ”οΈ βœ”
freezed_annotation βœ– βœ”οΈ βœ”οΈ βœ”
json_annotation βœ”οΈ βœ”οΈ βœ”οΈ βœ”
json_serializable βœ”οΈ βœ”οΈ βœ”οΈ βœ”
build_runner βœ”οΈ βœ”οΈ βœ”οΈ βœ”
logger βœ”οΈ βœ”οΈ βœ”οΈ βœ”
dartz βœ”οΈ βœ–οΈ βœ–οΈ βœ–
flutter_spinkit βœ”οΈ βœ”οΈ βœ”οΈ βœ”
intl βœ”οΈ βœ”οΈ βœ”οΈ βœ”


πŸ“š Dependencies (MVVM architecture version (Layer-first))

Name GetX Cubit Bloc
flutter_bloc βœ–οΈ βœ” βœ”
get_it βœ”οΈ βœ” βœ”
GetX βœ”οΈ βœ–οΈ βœ–οΈ
dio βœ”οΈ βœ”οΈ βœ”οΈ
freezed βœ–οΈ βœ”οΈ βœ”οΈ
freezed_annotation βœ– βœ”οΈ βœ”οΈ
json_annotation βœ”οΈ βœ”οΈ βœ”οΈ
json_serializable βœ”οΈ βœ”οΈ βœ”οΈ
build_runner βœ”οΈ βœ”οΈ βœ”οΈ
logger βœ”οΈ βœ”οΈ βœ”οΈ
dartz βœ”οΈ βœ–οΈ βœ–οΈ
flutter_spinkit βœ”οΈ βœ”οΈ βœ”οΈ
intl βœ”οΈ βœ”οΈ βœ”οΈ

πŸ“š Dependencies (Simple layered architecture version (Feature-first))

Name GetX Cubit Bloc
flutter_bloc βœ–οΈ βœ” βœ”
GetX βœ”οΈ βœ–οΈ βœ–οΈ
dio βœ”οΈ βœ”οΈ βœ”οΈ
freezed βœ–οΈ βœ”οΈ βœ”οΈ
freezed_annotation βœ– βœ”οΈ βœ”οΈ
json_annotation βœ”οΈ βœ”οΈ βœ”οΈ
json_serializable βœ”οΈ βœ”οΈ βœ”οΈ
build_runner βœ”οΈ βœ”οΈ βœ”οΈ
logger βœ”οΈ βœ”οΈ βœ”οΈ
dartz βœ”οΈ βœ–οΈ βœ–οΈ
flutter_spinkit βœ”οΈ βœ”οΈ βœ”οΈ
intl βœ”οΈ βœ”οΈ βœ”οΈ



πŸ“‚ Directory Structure (Clean architecture version + Bloc)

πŸ“‚lib
│───main.dart  
│───di.dart  
β”‚β”€β”€β”€πŸ“‚common  
β”‚   β”‚β”€β”€β”€πŸ“‚bloc
β”‚   β”‚   │──bloc_helper.dart
β”‚   β”‚   └──generic_bloc_state.dart
β”‚   β”‚β”€β”€β”€πŸ“‚usecase
β”‚   β”‚   └──usecase.dart
β”‚   β”‚β”€β”€β”€πŸ“‚repository
β”‚   β”‚   └──repository_helper.dart
β”‚   β”‚β”€β”€β”€πŸ“‚network
β”‚   β”‚   │──api_config.dart
β”‚   β”‚   │──api_helper.dart
β”‚   β”‚   │──api_result.dart
β”‚   β”‚   │──api_result.freezed.dart
β”‚   β”‚   │──dio_client.dart
β”‚   β”‚   │──dio_exception.dart
β”‚   β”‚   └──dio_interceptor.dart
β”‚   β”‚β”€β”€β”€πŸ“‚widget
β”‚   β”‚   │──date_time_picker.dart
β”‚   β”‚   │──drop_down.dart
β”‚   β”‚   │──empty_widget.dart
β”‚   β”‚   │──popup_menu.dart
β”‚   β”‚   │──spinkit_indicator.dart
β”‚   β”‚   └──text_input.dart
β”‚   β””β”€β”€β”€πŸ“‚dialog
β”‚       │──create_dialog.dart
β”‚       │──delete_dialog.dart
β”‚       │──progress_dialog.dart
β”‚       └──retry_dialog.dart
β”‚β”€β”€β”€πŸ“‚core
β”‚   │──app_asset.dart
β”‚   │──app_extension.dart
β”‚   │──app_string.dart
β”‚   │──app_style.dart
β”‚   └──app_theme.dart
β”‚
β””β”€β”€β”€πŸ“‚features
    β”‚β”€β”€β”€πŸ“‚user
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──user_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──user.dart
    β”‚    β”‚   β”‚   └──user.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──user_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──user_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──user_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_user_usecase.dart
    β”‚    β”‚   β”‚   │──delete_user_usecase.dart
    β”‚    β”‚   β”‚   │──get_users_usecase.dart
    β”‚    β”‚   β”‚   └──update_user_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚bloc
    β”‚        β”‚   │──user_bloc.dart
    β”‚        β”‚   └──user_event.dart
    β”‚        β”‚β”€β”€β”€πŸ“‚screens
    β”‚        β”‚   └──user_list_screen.dart
    β”‚        β””β”€β”€β”€πŸ“‚widgets
    β”‚            └──status_container.dart
    β”‚
    β”‚β”€β”€β”€πŸ“‚todo
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──todo_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──todo.dart
    β”‚    β”‚   β”‚   └──todo.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──todo_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──todo_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──todo_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_todo_usecase.dart
    β”‚    β”‚   β”‚   │──delete_todo_usecase.dart
    β”‚    β”‚   β”‚   │──get_todos_usecase.dart
    β”‚    β”‚   β”‚   └──update_todo_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚bloc
    β”‚        β”‚   │──todo_bloc.dart
    β”‚        β”‚   └──todo_event.dart
    β”‚        β”‚β”€β”€β”€πŸ“‚screens
    β”‚        β”‚   └──todo_list_screen.dart
    β”‚        β””β”€β”€β”€πŸ“‚widgets
    β”‚            │──circle_container.dart
    β”‚            └──todo_list_item.dart
    β”‚β”€β”€β”€πŸ“‚post
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──post_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──post.dart
    β”‚    β”‚   β”‚   └──post.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──post_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──post_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──post_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_post_usecase.dart
    β”‚    β”‚   β”‚   │──delete_post_usecase.dart
    β”‚    β”‚   β”‚   │──get_posts_usecase.dart
    β”‚    β”‚   β”‚   └──update_post_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚bloc
    β”‚        β”‚   │──post_bloc.dart
    β”‚        β”‚   └──post_event.dart
    β”‚        β””β”€β”€β”€πŸ“‚screens
    β”‚            │──create_post_screen.dart
    β”‚            │──post_detail_screen.dart
    β”‚            └──post_list_screen.dart
    β””β”€β”€β”€πŸ“‚comment
         β”‚β”€β”€β”€πŸ“‚data
         β”‚   β”‚β”€β”€πŸ“‚datasources
         β”‚   β”‚  └──comment_remote_data_source.dart
         β”‚   β”‚β”€β”€πŸ“‚models
         β”‚   β”‚   │──comment.dart
         β”‚   β”‚   └──comment.g.dart
         β”‚   β””β”€β”€πŸ“‚repositories
         β”‚       └──comment_repository_impl.dart
         β”‚β”€β”€β”€πŸ“‚domain
         β”‚   β”‚β”€β”€β”€πŸ“‚entities
         β”‚   β”‚   └──comment_entity.dart
         β”‚   β”‚β”€β”€β”€πŸ“‚repositories
         β”‚   β”‚   └──comment_repository.dart
         β”‚   β”‚β”€β”€β”€πŸ“‚usecases
         β”‚   β”‚   │──create_comment_usecase.dart
         β”‚   β”‚   │──delete_comment_usecase.dart
         β”‚   β”‚   └──get_comments_usecase.dart
         └── πŸ“‚presentation
             β””β”€β”€β”€πŸ“‚bloc
                 │──comment_bloc.dart
                 └──comment_event.dart




πŸ“‚ Directory Structure (Clean architecture version + Cubit)

πŸ“‚lib
│───main.dart  
│───di.dart  
β”‚β”€β”€β”€πŸ“‚common  
β”‚   β”‚β”€β”€β”€πŸ“‚cubit
β”‚   β”‚   │──generic_cubit.dart
β”‚   β”‚   └──generic_cubit_state.dart
β”‚   β”‚β”€β”€β”€πŸ“‚usecase
β”‚   β”‚   └──usecase.dart
β”‚   β”‚β”€β”€β”€πŸ“‚repository
β”‚   β”‚   └──repository_helper.dart
β”‚   β”‚β”€β”€β”€πŸ“‚network
β”‚   β”‚   │──api_config.dart
β”‚   β”‚   │──api_helper.dart
β”‚   β”‚   │──api_result.dart
β”‚   β”‚   │──api_result.freezed.dart
β”‚   β”‚   │──dio_client.dart
β”‚   β”‚   │──dio_exception.dart
β”‚   β”‚   └──dio_interceptor.dart
β”‚   β”‚β”€β”€β”€πŸ“‚widget
β”‚   β”‚   │──date_time_picker.dart
β”‚   β”‚   │──drop_down.dart
β”‚   β”‚   │──empty_widget.dart
β”‚   β”‚   │──popup_menu.dart
β”‚   β”‚   │──spinkit_indicator.dart
β”‚   β”‚   └──text_input.dart
β”‚   β””β”€β”€β”€πŸ“‚dialog
β”‚       │──create_dialog.dart
β”‚       │──delete_dialog.dart
β”‚       │──progress_dialog.dart
β”‚       └──retry_dialog.dart
β”‚β”€β”€β”€πŸ“‚core
β”‚   │──app_asset.dart
β”‚   │──app_extension.dart
β”‚   │──app_string.dart
β”‚   │──app_style.dart
β”‚   └──app_theme.dart
β”‚
β””β”€β”€β”€πŸ“‚features
    β”‚β”€β”€β”€πŸ“‚user
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──user_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──user.dart
    β”‚    β”‚   β”‚   └──user.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──user_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──user_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──user_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_user_usecase.dart
    β”‚    β”‚   β”‚   │──delete_user_usecase.dart
    β”‚    β”‚   β”‚   │──get_users_usecase.dart
    β”‚    β”‚   β”‚   └──update_user_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚cubit
    β”‚        β”‚   └──user_cubit.dart
    β”‚        β”‚β”€β”€β”€πŸ“‚screens
    β”‚        β”‚   └──user_list_screen.dart
    β”‚        β””β”€β”€β”€πŸ“‚widgets
    β”‚            └──status_container.dart
    β”‚
    β”‚β”€β”€β”€πŸ“‚todo
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──todo_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──todo.dart
    β”‚    β”‚   β”‚   └──todo.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──todo_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──todo_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──todo_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_todo_usecase.dart
    β”‚    β”‚   β”‚   │──delete_todo_usecase.dart
    β”‚    β”‚   β”‚   │──get_todos_usecase.dart
    β”‚    β”‚   β”‚   └──update_todo_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚cubit
    β”‚        β”‚   └──todo_cubit.dart
    β”‚        β”‚β”€β”€β”€πŸ“‚screens
    β”‚        β”‚   └──todo_list_screen.dart
    β”‚        β””β”€β”€β”€πŸ“‚widgets
    β”‚            │──circle_container.dart
    β”‚            └──todo_list_item.dart
    β”‚β”€β”€β”€πŸ“‚post
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──post_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──post.dart
    β”‚    β”‚   β”‚   └──post.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──post_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──post_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──post_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_post_usecase.dart
    β”‚    β”‚   β”‚   │──delete_post_usecase.dart
    β”‚    β”‚   β”‚   │──get_posts_usecase.dart
    β”‚    β”‚   β”‚   └──update_post_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚cubit
    β”‚        β”‚   └──post_cubit.dart
    β”‚        β””β”€β”€β”€πŸ“‚screens
    β”‚            │──create_post_screen.dart
    β”‚            │──post_detail_screen.dart
    β”‚            └──post_list_screen.dart
    β””β”€β”€β”€πŸ“‚comment
         β”‚β”€β”€β”€πŸ“‚data
         β”‚   β”‚β”€β”€πŸ“‚datasources
         β”‚   β”‚  └──comment_remote_data_source.dart
         β”‚   β”‚β”€β”€πŸ“‚models
         β”‚   β”‚   │──comment.dart
         β”‚   β”‚   └──comment.g.dart
         β”‚   β””β”€β”€πŸ“‚repositories
         β”‚       └──comment_repository_impl.dart
         β”‚β”€β”€β”€πŸ“‚domain
         β”‚   β”‚β”€β”€β”€πŸ“‚entities
         β”‚   β”‚   └──comment_entity.dart
         β”‚   β”‚β”€β”€β”€πŸ“‚repositories
         β”‚   β”‚   └──comment_repository.dart
         β”‚   β”‚β”€β”€β”€πŸ“‚usecases
         β”‚   β”‚   │──create_comment_usecase.dart
         β”‚   β”‚   │──delete_comment_usecase.dart
         β”‚   β”‚   └──get_comments_usecase.dart
         └── πŸ“‚presentation
             β””β”€β”€β”€πŸ“‚cubit
                 └──comment_cubit.dart




πŸ“‚ Directory Structure (Clean architecture version + RxDart + Provider)

πŸ“‚lib
│───main.dart  
│───di.dart  
β”‚β”€β”€β”€πŸ“‚common  
β”‚   β”‚β”€β”€β”€πŸ“‚bloc
β”‚   β”‚   └──generic_bloc_state.dart
β”‚   β”‚β”€β”€β”€πŸ“‚usecase
β”‚   β”‚   └──usecase.dart
β”‚   β”‚β”€β”€β”€πŸ“‚repository
β”‚   β”‚   └──repository_helper.dart
β”‚   β”‚β”€β”€β”€πŸ“‚network
β”‚   β”‚   │──api_config.dart
β”‚   β”‚   │──api_helper.dart
β”‚   β”‚   │──api_result.dart
β”‚   β”‚   │──api_result.freezed.dart
β”‚   β”‚   │──dio_client.dart
β”‚   β”‚   │──dio_exception.dart
β”‚   β”‚   └──dio_interceptor.dart
β”‚   β”‚β”€β”€β”€πŸ“‚widget
β”‚   β”‚   │──date_time_picker.dart
β”‚   β”‚   │──drop_down.dart
β”‚   β”‚   │──empty_widget.dart
β”‚   β”‚   │──popup_menu.dart
β”‚   β”‚   │──spinkit_indicator.dart
β”‚   β”‚   └──text_input.dart
β”‚   β””β”€β”€β”€πŸ“‚dialog
β”‚       │──create_dialog.dart
β”‚       │──delete_dialog.dart
β”‚       │──progress_dialog.dart
β”‚       └──retry_dialog.dart
β”‚β”€β”€β”€πŸ“‚core
β”‚   │──app_asset.dart
β”‚   │──app_extension.dart
β”‚   │──app_string.dart
β”‚   │──app_style.dart
β”‚   └──app_theme.dart
β”‚
β””β”€β”€β”€πŸ“‚features
    β”‚β”€β”€β”€πŸ“‚user
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──user_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──user.dart
    β”‚    β”‚   β”‚   └──user.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──user_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──user_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──user_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_user_usecase.dart
    β”‚    β”‚   β”‚   │──delete_user_usecase.dart
    β”‚    β”‚   β”‚   │──get_users_usecase.dart
    β”‚    β”‚   β”‚   └──update_user_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚bloc
    β”‚        β”‚   │──user_bloc.dart
    β”‚        β”‚   └──user_event.dart
    β”‚        β”‚β”€β”€β”€πŸ“‚screens
    β”‚        β”‚   └──user_list_screen.dart
    β”‚        β””β”€β”€β”€πŸ“‚widgets
    β”‚            └──status_container.dart
    β”‚
    β”‚β”€β”€β”€πŸ“‚todo
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──todo_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──todo.dart
    β”‚    β”‚   β”‚   └──todo.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──todo_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──todo_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──todo_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_todo_usecase.dart
    β”‚    β”‚   β”‚   │──delete_todo_usecase.dart
    β”‚    β”‚   β”‚   │──get_todos_usecase.dart
    β”‚    β”‚   β”‚   └──update_todo_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚bloc
    β”‚        β”‚   │──todo_bloc.dart
    β”‚        β”‚   └──todo_event.dart
    β”‚        β”‚β”€β”€β”€πŸ“‚screens
    β”‚        β”‚   └──todo_list_screen.dart
    β”‚        β””β”€β”€β”€πŸ“‚widgets
    β”‚            │──circle_container.dart
    β”‚            └──todo_list_item.dart
    β”‚β”€β”€β”€πŸ“‚post
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──post_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──post.dart
    β”‚    β”‚   β”‚   └──post.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──post_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──post_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──post_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_post_usecase.dart
    β”‚    β”‚   β”‚   │──delete_post_usecase.dart
    β”‚    β”‚   β”‚   │──get_posts_usecase.dart
    β”‚    β”‚   β”‚   └──update_post_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚bloc
    β”‚        β”‚   └──post_bloc.dart
    β”‚        β””β”€β”€β”€πŸ“‚screens
    β”‚            │──create_post_screen.dart
    β”‚            │──post_detail_screen.dart
    β”‚            └──post_list_screen.dart
    β””β”€β”€β”€πŸ“‚comment
         β”‚β”€β”€β”€πŸ“‚data
         β”‚   β”‚β”€β”€πŸ“‚datasources
         β”‚   β”‚  └──comment_remote_data_source.dart
         β”‚   β”‚β”€β”€πŸ“‚models
         β”‚   β”‚   │──comment.dart
         β”‚   β”‚   └──comment.g.dart
         β”‚   β””β”€β”€πŸ“‚repositories
         β”‚       └──comment_repository_impl.dart
         β”‚β”€β”€β”€πŸ“‚domain
         β”‚   β”‚β”€β”€β”€πŸ“‚entities
         β”‚   β”‚   └──comment_entity.dart
         β”‚   β”‚β”€β”€β”€πŸ“‚repositories
         β”‚   β”‚   └──comment_repository.dart
         β”‚   β”‚β”€β”€β”€πŸ“‚usecases
         β”‚   β”‚   │──create_comment_usecase.dart
         β”‚   β”‚   │──delete_comment_usecase.dart
         β”‚   β”‚   └──get_comments_usecase.dart
         └── πŸ“‚presentation
             β””β”€β”€β”€πŸ“‚bloc
                 └──comment_bloc.dart




πŸ“‚ Directory Structure (Clean architecture version + GetX)

πŸ“‚lib
│───main.dart  
│───di.dart  
β”‚β”€β”€β”€πŸ“‚common  
β”‚   β”‚β”€β”€β”€πŸ“‚controller
β”‚   β”‚   └──base_controller.dart
β”‚   β”‚β”€β”€β”€πŸ“‚usecase
β”‚   β”‚   └──usecase.dart
β”‚   β”‚β”€β”€β”€πŸ“‚repository
β”‚   β”‚   └──repository_helper.dart
β”‚   β”‚β”€β”€β”€πŸ“‚network
β”‚   β”‚   │──api_config.dart
β”‚   β”‚   │──api_base.dart
β”‚   β”‚   │──dio_client.dart
β”‚   β”‚   │──dio_exception.dart
β”‚   β”‚   └──dio_interceptor.dart
β”‚   β”‚β”€β”€β”€πŸ“‚widget
β”‚   β”‚   │──date_time_picker.dart
β”‚   β”‚   │──drop_down.dart
β”‚   β”‚   │──empty_widget.dart
β”‚   β”‚   │──popup_menu.dart
β”‚   β”‚   │──spinkit_indicator.dart
β”‚   β”‚   └──text_input.dart
β”‚   β””β”€β”€β”€πŸ“‚dialog
β”‚       │──create_dialog.dart
β”‚       │──delete_dialog.dart
β”‚       │──progress_dialog.dart
β”‚       └──retry_dialog.dart
β”‚β”€β”€β”€πŸ“‚core
β”‚   │──app_asset.dart
β”‚   │──app_extension.dart
β”‚   │──app_string.dart
β”‚   │──app_style.dart
β”‚   └──app_theme.dart
β”‚
β””β”€β”€β”€πŸ“‚features
    β”‚β”€β”€β”€πŸ“‚user
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──user_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──user.dart
    β”‚    β”‚   β”‚   └──user.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──user_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──user_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──user_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_user_usecase.dart
    β”‚    β”‚   β”‚   │──delete_user_usecase.dart
    β”‚    β”‚   β”‚   │──get_users_usecase.dart
    β”‚    β”‚   β”‚   └──update_user_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚controller
    β”‚        β”‚   └──user_controller.dart
    β”‚        β”‚β”€β”€β”€πŸ“‚screens
    β”‚        β”‚   └──user_list_screen.dart
    β”‚        β””β”€β”€β”€πŸ“‚widgets
    β”‚            └──status_container.dart
    β”‚
    β”‚β”€β”€β”€πŸ“‚todo
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──todo_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──todo.dart
    β”‚    β”‚   β”‚   └──todo.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──todo_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──todo_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──todo_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_todo_usecase.dart
    β”‚    β”‚   β”‚   │──delete_todo_usecase.dart
    β”‚    β”‚   β”‚   │──get_todos_usecase.dart
    β”‚    β”‚   β”‚   └──update_todo_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚controller
    β”‚        β”‚   └──todo_controller.dart
    β”‚        β”‚β”€β”€β”€πŸ“‚screens
    β”‚        β”‚   └──todo_list_screen.dart
    β”‚        β””β”€β”€β”€πŸ“‚widgets
    β”‚            │──circle_container.dart
    β”‚            └──todo_list_item.dart
    β”‚β”€β”€β”€πŸ“‚post
    β”‚    β”‚β”€β”€β”€πŸ“‚data
    β”‚    β”‚   β”‚β”€β”€πŸ“‚datasources
    β”‚    β”‚   β”‚  └──post_remote_data_source.dart
    β”‚    β”‚   β”‚β”€β”€πŸ“‚models
    β”‚    β”‚   β”‚   │──post.dart
    β”‚    β”‚   β”‚   └──post.g.dart
    β”‚    β”‚   β””β”€β”€πŸ“‚repositories
    β”‚    β”‚       └──post_repository_impl.dart
    β”‚    β”‚β”€β”€β”€πŸ“‚domain
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚entities
    β”‚    β”‚   β”‚   └──post_entity.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚repositories
    β”‚    β”‚   β”‚   └──post_repository.dart
    β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚usecases
    β”‚    β”‚   β”‚   │──create_post_usecase.dart
    β”‚    β”‚   β”‚   │──delete_post_usecase.dart
    β”‚    β”‚   β”‚   │──get_posts_usecase.dart
    β”‚    β”‚   β”‚   └──update_post_usecase.dart
    β”‚    └── πŸ“‚presentation
    β”‚        β”‚β”€β”€β”€πŸ“‚controller
    β”‚        β”‚   └──post_controller.dart
    β”‚        β””β”€β”€β”€πŸ“‚screens
    β”‚            │──create_post_screen.dart
    β”‚            │──post_detail_screen.dart
    β”‚            └──post_list_screen.dart
    β””β”€β”€β”€πŸ“‚comment
         β”‚β”€β”€β”€πŸ“‚data
         β”‚   β”‚β”€β”€πŸ“‚datasources
         β”‚   β”‚  └──comment_remote_data_source.dart
         β”‚   β”‚β”€β”€πŸ“‚models
         β”‚   β”‚   │──comment.dart
         β”‚   β”‚   └──comment.g.dart
         β”‚   β””β”€β”€πŸ“‚repositories
         β”‚       └──comment_repository_impl.dart
         β”‚β”€β”€β”€πŸ“‚domain
         β”‚   β”‚β”€β”€β”€πŸ“‚entities
         β”‚   β”‚   └──comment_entity.dart
         β”‚   β”‚β”€β”€β”€πŸ“‚repositories
         β”‚   β”‚   └──comment_repository.dart
         β”‚   β”‚β”€β”€β”€πŸ“‚usecases
         β”‚   β”‚   │──create_comment_usecase.dart
         β”‚   β”‚   │──delete_comment_usecase.dart
         β”‚   β”‚   └──get_comments_usecase.dart
         └── πŸ“‚presentation
             β””β”€β”€β”€πŸ“‚controller
                 └──comment_controller.dart




πŸ“‚ Directory Structure (MVVM architecture version + Bloc)

πŸ“‚lib
│───main.dart  
│───di.dart  
β”‚β”€β”€β”€πŸ“‚common  
β”‚   β”‚β”€β”€β”€πŸ“‚bloc
β”‚   β”‚   │──bloc_helper.dart
β”‚   β”‚   └──generic_bloc_state.dart
β”‚   β”‚β”€β”€β”€πŸ“‚repository
β”‚   β”‚   └──repository_helper.dart
β”‚   β”‚β”€β”€β”€πŸ“‚network
β”‚   β”‚   │──api_helper.dart
β”‚   β”‚   │──api_result.dart
β”‚   β”‚   │──api_result.freezed.dart
β”‚   β”‚   │──dio_client.dart
β”‚   β”‚   │──dio_exception.dart
β”‚   β”‚   └──dio_interceptor.dart
β”‚   β”‚β”€β”€β”€πŸ“‚widget
β”‚   β”‚   │──date_time_picker.dart
β”‚   β”‚   │──drop_down.dart
β”‚   β”‚   │──empty_widget.dart
β”‚   β”‚   │──popup_menu.dart
β”‚   β”‚   │──spinkit_indicator.dart
β”‚   β”‚   └──text_input.dart
β”‚   β””β”€β”€β”€πŸ“‚dialog
β”‚       │──create_dialog.dart
β”‚       │──delete_dialog.dart
β”‚       │──progress_dialog.dart
β”‚       └──retry_dialog.dart
β”‚β”€β”€β”€πŸ“‚core
β”‚   │──api_config.dart
β”‚   │──app_asset.dart
β”‚   │──app_extension.dart
β”‚   │──app_string.dart
β”‚   │──app_style.dart
β”‚   └──app_theme.dart
β”‚
β”‚β”€β”€β”€πŸ“‚data
β”‚   β”‚β”€β”€β”€πŸ“‚api
β”‚   β”‚    β”‚β”€β”€β”€πŸ“‚comment
β”‚   β”‚    β”‚   └──comment_api.dart
β”‚   β”‚    β”‚β”€β”€β”€πŸ“‚post
β”‚   β”‚    β”‚   └──post_api.dart
β”‚   β”‚    β”‚β”€β”€β”€πŸ“‚todo
β”‚   β”‚    β”‚   └──todo_api.dart
β”‚   β”‚    β””β”€β”€β”€πŸ“‚user
β”‚   β”‚        └──user_api.dart
β”‚   β”‚    
β”‚   β””β”€β”€β”€πŸ“‚model 
β”‚        β”‚β”€β”€β”€πŸ“‚comment
β”‚        β”‚   │──comment.dart
β”‚        β”‚   └──comment.g.dart
β”‚        β”‚β”€β”€β”€πŸ“‚post
β”‚        β”‚   │──post.dart
β”‚        β”‚   └──post.g.dart
β”‚        β”‚β”€β”€β”€πŸ“‚todo
β”‚        β”‚   │──todo.dart
β”‚        β”‚   └──todo.g.dart
β”‚        β””β”€β”€β”€πŸ“‚user
β”‚            │──user.dart
β”‚            └──user.g.dart 
β”‚    
β”‚β”€β”€β”€πŸ“‚repository
β”‚    β”‚β”€β”€β”€πŸ“‚comment
β”‚    β”‚   └──comment_repository.dart
β”‚    β”‚β”€β”€β”€πŸ“‚post
β”‚    β”‚   └──post_repository.dart
β”‚    β”‚β”€β”€β”€πŸ“‚todo
β”‚    β”‚   └──todo_repository.dart
β”‚    β””β”€β”€β”€πŸ“‚user
β”‚        └──user_repository.dart
β”‚
β”‚β”€β”€β”€πŸ“‚view
β”‚    β”‚β”€β”€β”€πŸ“‚post
β”‚    β”‚   β””β”€β”€πŸ“‚screen
β”‚    β”‚      │──create_post_screen.dart
β”‚    β”‚      │──post_detail_screen.dart
β”‚    β”‚      └──post_list_screen.dart
β”‚    β”‚    
β”‚    β”‚β”€β”€β”€πŸ“‚todo
β”‚    β”‚   β”‚β”€β”€πŸ“‚screen
β”‚    β”‚   β”‚  └──todo_list_screen.dart
β”‚    β”‚   β””β”€β”€πŸ“‚widget
β”‚    β”‚      │──circle_container.dart
β”‚    β”‚      └──todo_list_item.dart
β”‚    β”‚
β”‚    β””β”€β”€β”€πŸ“‚user
β”‚        β”‚β”€β”€πŸ“‚screen
β”‚        β”‚  └──user_list_screen.dart
β”‚        β””β”€β”€πŸ“‚widget
β”‚           └──status_container.dart
β”‚     
β””β”€β”€β”€πŸ“‚viewmodel
         β”‚β”€β”€β”€πŸ“‚comment
         β”‚   β””β”€β”€πŸ“‚bloc
         β”‚      └──comment_bloc.dart
         β”‚      └──comment_event.dart
         β”‚β”€β”€β”€πŸ“‚post
         β”‚   β””β”€β”€πŸ“‚bloc
         β”‚      └──post_bloc.dart
         β”‚      └──post_event.dart
         β”‚β”€β”€β”€πŸ“‚todo
         β”‚   β””β”€β”€πŸ“‚bloc
         β”‚      │──todo_bloc.dart
         β”‚      └──todo_event.dart
         β””β”€β”€β”€πŸ“‚user
             β””β”€β”€πŸ“‚bloc
                │──user_bloc.dart
                └──user_event.dart




πŸ“‚ Directory Structure (MVVM architecture version + Cubit)

πŸ“‚lib
│───main.dart  
│───di.dart  
β”‚β”€β”€β”€πŸ“‚common  
β”‚   β”‚β”€β”€β”€πŸ“‚cubit
β”‚   β”‚   │──generic_cubit.dart
β”‚   β”‚   └──generic_cubit_state.dart
β”‚   β”‚β”€β”€β”€πŸ“‚repository
β”‚   β”‚   └──repository_helper.dart
β”‚   β”‚β”€β”€β”€πŸ“‚network
β”‚   β”‚   │──api_helper.dart
β”‚   β”‚   │──api_result.dart
β”‚   β”‚   │──api_result.freezed.dart
β”‚   β”‚   │──dio_client.dart
β”‚   β”‚   │──dio_exception.dart
β”‚   β”‚   └──dio_interceptor.dart
β”‚   β”‚β”€β”€β”€πŸ“‚widget
β”‚   β”‚   │──date_time_picker.dart
β”‚   β”‚   │──drop_down.dart
β”‚   β”‚   │──empty_widget.dart
β”‚   β”‚   │──popup_menu.dart
β”‚   β”‚   │──spinkit_indicator.dart
β”‚   β”‚   └──text_input.dart
β”‚   β””β”€β”€β”€πŸ“‚dialog
β”‚       │──create_dialog.dart
β”‚       │──delete_dialog.dart
β”‚       │──progress_dialog.dart
β”‚       └──retry_dialog.dart
β”‚β”€β”€β”€πŸ“‚core
β”‚   │──api_config.dart
β”‚   │──app_asset.dart
β”‚   │──app_extension.dart
β”‚   │──app_string.dart
β”‚   │──app_style.dart
β”‚   └──app_theme.dart
β”‚
β”‚β”€β”€β”€πŸ“‚data
β”‚   β”‚β”€β”€β”€πŸ“‚api
β”‚   β”‚    β”‚β”€β”€β”€πŸ“‚comment
β”‚   β”‚    β”‚   └──comment_api.dart
β”‚   β”‚    β”‚β”€β”€β”€πŸ“‚post
β”‚   β”‚    β”‚   └──post_api.dart
β”‚   β”‚    β”‚β”€β”€β”€πŸ“‚todo
β”‚   β”‚    β”‚   └──todo_api.dart
β”‚   β”‚    β””β”€β”€β”€πŸ“‚user
β”‚   β”‚        └──user_api.dart
β”‚   β”‚    
β”‚   β””β”€β”€β”€πŸ“‚model 
β”‚        β”‚β”€β”€β”€πŸ“‚comment
β”‚        β”‚   │──comment.dart
β”‚        β”‚   └──comment.g.dart
β”‚        β”‚β”€β”€β”€πŸ“‚post
β”‚        β”‚   │──post.dart
β”‚        β”‚   └──post.g.dart
β”‚        β”‚β”€β”€β”€πŸ“‚todo
β”‚        β”‚   │──todo.dart
β”‚        β”‚   └──todo.g.dart
β”‚        β””β”€β”€β”€πŸ“‚user
β”‚            │──user.dart
β”‚            └──user.g.dart 
β”‚    
β”‚β”€β”€β”€πŸ“‚repository
β”‚    β”‚β”€β”€β”€πŸ“‚comment
β”‚    β”‚   └──comment_repository.dart
β”‚    β”‚β”€β”€β”€πŸ“‚post
β”‚    β”‚   └──post_repository.dart
β”‚    β”‚β”€β”€β”€πŸ“‚todo
β”‚    β”‚   └──todo_repository.dart
β”‚    β””β”€β”€β”€πŸ“‚user
β”‚        └──user_repository.dart
β”‚
β”‚β”€β”€β”€πŸ“‚view
β”‚    β”‚β”€β”€β”€πŸ“‚post
β”‚    β”‚   β””β”€β”€πŸ“‚screen
β”‚    β”‚      │──create_post_screen.dart
β”‚    β”‚      │──post_detail_screen.dart
β”‚    β”‚      └──post_list_screen.dart
β”‚    β”‚    
β”‚    β”‚β”€β”€β”€πŸ“‚todo
β”‚    β”‚   β”‚β”€β”€πŸ“‚screen
β”‚    β”‚   β”‚  └──todo_list_screen.dart
β”‚    β”‚   β””β”€β”€πŸ“‚widget
β”‚    β”‚      │──circle_container.dart
β”‚    β”‚      └──todo_list_item.dart
β”‚    β”‚
β”‚    β””β”€β”€β”€πŸ“‚user
β”‚        β”‚β”€β”€πŸ“‚screen
β”‚        β”‚  └──user_list_screen.dart
β”‚        β””β”€β”€πŸ“‚widget
β”‚           └──status_container.dart
β”‚     
β””β”€β”€β”€πŸ“‚viewmodel
         β”‚β”€β”€β”€πŸ“‚comment
         β”‚   β””β”€β”€πŸ“‚cubit
         β”‚      └──comment_cubit.dart
         β”‚β”€β”€β”€πŸ“‚post
         β”‚   β””β”€β”€πŸ“‚cubit
         β”‚      └──post_cubit.dart
         β”‚β”€β”€β”€πŸ“‚todo
         β”‚   β””β”€β”€πŸ“‚cubit
         β”‚      └──todo_cubit.dart
         β””β”€β”€β”€πŸ“‚user
             β””β”€β”€πŸ“‚cubit
                └──user_cubit.dart




πŸ“‚ Directory Structure (MVVM architecture version + GetX)

πŸ“‚lib
│───main.dart  
│───di.dart  
β”‚β”€β”€β”€πŸ“‚common  
β”‚   β”‚β”€β”€β”€πŸ“‚controller
β”‚   β”‚   └──base_controller.dart
β”‚   β”‚β”€β”€β”€πŸ“‚repository
β”‚   β”‚   └──repository_helper.dart
β”‚   β”‚β”€β”€β”€πŸ“‚network
β”‚   β”‚   │──api_helper.dart
β”‚   β”‚   │──api_result.dart
β”‚   β”‚   │──api_result.freezed.dart
β”‚   β”‚   │──dio_client.dart
β”‚   β”‚   │──dio_exception.dart
β”‚   β”‚   └──dio_interceptor.dart
β”‚   β”‚β”€β”€β”€πŸ“‚widget
β”‚   β”‚   │──date_time_picker.dart
β”‚   β”‚   │──drop_down.dart
β”‚   β”‚   │──empty_widget.dart
β”‚   β”‚   │──popup_menu.dart
β”‚   β”‚   │──spinkit_indicator.dart
β”‚   β”‚   └──text_input.dart
β”‚   β””β”€β”€β”€πŸ“‚dialog
β”‚       │──create_dialog.dart
β”‚       │──delete_dialog.dart
β”‚       │──progress_dialog.dart
β”‚       └──retry_dialog.dart
β”‚β”€β”€β”€πŸ“‚core
β”‚   │──api_config.dart
β”‚   │──app_asset.dart
β”‚   │──app_extension.dart
β”‚   │──app_string.dart
β”‚   │──app_style.dart
β”‚   └──app_theme.dart
β”‚
β”‚β”€β”€β”€πŸ“‚data
β”‚   β”‚β”€β”€β”€πŸ“‚api
β”‚   β”‚    β”‚β”€β”€β”€πŸ“‚comment
β”‚   β”‚    β”‚   └──comment_api.dart
β”‚   β”‚    β”‚β”€β”€β”€πŸ“‚post
β”‚   β”‚    β”‚   └──post_api.dart
β”‚   β”‚    β”‚β”€β”€β”€πŸ“‚todo
β”‚   β”‚    β”‚   └──todo_api.dart
β”‚   β”‚    β””β”€β”€β”€πŸ“‚user
β”‚   β”‚        └──user_api.dart
β”‚   β”‚    
β”‚   β””β”€β”€β”€πŸ“‚model 
β”‚        β”‚β”€β”€β”€πŸ“‚comment
β”‚        β”‚   │──comment.dart
β”‚        β”‚   └──comment.g.dart
β”‚        β”‚β”€β”€β”€πŸ“‚post
β”‚        β”‚   │──post.dart
β”‚        β”‚   └──post.g.dart
β”‚        β”‚β”€β”€β”€πŸ“‚todo
β”‚        β”‚   │──todo.dart
β”‚        β”‚   └──todo.g.dart
β”‚        β””β”€β”€β”€πŸ“‚user
β”‚            │──user.dart
β”‚            └──user.g.dart 
β”‚    
β”‚β”€β”€β”€πŸ“‚repository
β”‚    β”‚β”€β”€β”€πŸ“‚comment
β”‚    β”‚   └──comment_repository.dart
β”‚    β”‚β”€β”€β”€πŸ“‚post
β”‚    β”‚   └──post_repository.dart
β”‚    β”‚β”€β”€β”€πŸ“‚todo
β”‚    β”‚   └──todo_repository.dart
β”‚    β””β”€β”€β”€πŸ“‚user
β”‚        └──user_repository.dart
β”‚
β”‚β”€β”€β”€πŸ“‚view
β”‚    β”‚β”€β”€β”€πŸ“‚post
β”‚    β”‚   β””β”€β”€πŸ“‚screen
β”‚    β”‚      │──create_post_screen.dart
β”‚    β”‚      │──post_detail_screen.dart
β”‚    β”‚      └──post_list_screen.dart
β”‚    β”‚    
β”‚    β”‚β”€β”€β”€πŸ“‚todo
β”‚    β”‚   β”‚β”€β”€πŸ“‚screen
β”‚    β”‚   β”‚  └──todo_list_screen.dart
β”‚    β”‚   β””β”€β”€πŸ“‚widget
β”‚    β”‚      │──circle_container.dart
β”‚    β”‚      └──todo_list_item.dart
β”‚    β”‚
β”‚    β””β”€β”€β”€πŸ“‚user
β”‚        β”‚β”€β”€πŸ“‚screen
β”‚        β”‚  └──user_list_screen.dart
β”‚        β””β”€β”€πŸ“‚widget
β”‚           └──status_container.dart
β”‚     
β””β”€β”€β”€πŸ“‚viewmodel
         β”‚β”€β”€β”€πŸ“‚comment
         β”‚   β””β”€β”€πŸ“‚controller
         β”‚      └──comment_controller.dart
         β”‚β”€β”€β”€πŸ“‚post
         β”‚   β””β”€β”€πŸ“‚controller
         β”‚      └──post_controller.dart
         β”‚β”€β”€β”€πŸ“‚todo
         β”‚   β””β”€β”€πŸ“‚controller
         β”‚      └──todo_controller.dart
         β””β”€β”€β”€πŸ“‚user
             β””β”€β”€πŸ“‚controller
                └──user_controller.dart


πŸ“‚ Directory Structure (Simple layered architecture version + Cubit)

πŸ“‚lib
 │───main.dart  
 β”‚β”€β”€β”€πŸ“‚common  
 β”‚   β”‚β”€β”€β”€πŸ“‚cubit
 β”‚   β”‚   │──generic_cubit.dart
 β”‚   β”‚   └──generic_cubit_state.dart
 β”‚   β”‚β”€β”€β”€πŸ“‚network
 β”‚   β”‚   │──api_base.dart
 β”‚   β”‚   │──api_result.dart
 β”‚   β”‚   │──api_result.freezed.dart
 β”‚   β”‚   │──dio_client.dart
 β”‚   β”‚   │──dio_exception.dart
 β”‚   β”‚   └──dio_interceptor.dart
 β”‚   β”‚β”€β”€β”€πŸ“‚widget
 β”‚   β”‚   │──date_time_picker.dart
 β”‚   β”‚   │──drop_down.dart
 β”‚   β”‚   │──empty_widget.dart
 β”‚   β”‚   │──popup_menu.dart
 β”‚   β”‚   │──spinkit_indicator.dart
 β”‚   β”‚   └──text_input.dart 
 β”‚   β””β”€β”€β”€πŸ“‚dialog
 β”‚       │──create_dialog.dart
 β”‚       │──delete_dialog.dart
 β”‚       │──progress_dialog.dart
 β”‚       └──retry_dialog.dart
 β”‚β”€β”€β”€πŸ“‚core 
 β”‚   │──api_config.dart
 β”‚   │──app_asset.dart
 β”‚   │──app_extension.dart
 β”‚   │──app_string.dart
 β”‚   │──app_style.dart
 β”‚   └──app_theme.dart
 β””β”€β”€β”€πŸ“‚features
     β”‚β”€β”€β”€πŸ“‚comment
     β”‚    β”‚β”€β”€β”€πŸ“‚cubit
     β”‚    β”‚   └──comment_cubit.dart
     β”‚    β””β”€β”€β”€πŸ“‚data
     β”‚        β”‚β”€β”€β”€πŸ“‚model
     β”‚        β”‚   │──comment.dart
     β”‚        β”‚   └──comment.g.dart
     β”‚        β””β”€β”€β”€πŸ“‚provider
     β”‚            β””β”€β”€πŸ“‚remote
     β”‚               └──comment_api.dart
     β”‚β”€β”€β”€πŸ“‚post
     β”‚    β”‚β”€β”€β”€πŸ“‚cubit
     β”‚    β”‚   └──post_cubit.dart
     β”‚    β”‚β”€β”€β”€πŸ“‚data
     β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚model
     β”‚    β”‚   β”‚   │──post.dart
     β”‚    β”‚   β”‚   └──post.g.dart
     β”‚    β”‚   β””β”€β”€β”€πŸ“‚provider
     β”‚    β”‚       β””β”€β”€πŸ“‚remote
     β”‚    β”‚          └──psot_api.dart
     β”‚    β””β”€β”€β”€πŸ“‚view  
     β”‚        β””β”€β”€πŸ“‚screen
     β”‚           │──create_post_screen.dart
     β”‚           │──post_detail_screen.dart
     β”‚           └──post_list_screen.dart
     β”‚β”€β”€β”€πŸ“‚todo
     β”‚    β”‚β”€β”€β”€πŸ“‚cubit
     β”‚    β”‚   └──todo_cubit.dart
     β”‚    β”‚β”€β”€β”€πŸ“‚data
     β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚model
     β”‚    β”‚   β”‚   │──todo.dart
     β”‚    β”‚   β”‚   └──todo.g.dart
     β”‚    β”‚   β””β”€β”€β”€πŸ“‚provider
     β”‚    β”‚       β””β”€β”€πŸ“‚remote
     β”‚    β”‚          └──todo_api.dart
     β”‚    β””β”€β”€β”€πŸ“‚view  
     β”‚        β”‚β”€β”€πŸ“‚screen
     β”‚        β”‚  └──todo_list_screen.dart
     β”‚        β””β”€β”€πŸ“‚widget
     β”‚            │──circle_container.dart
     β”‚            └──todo_list_item.dart
     β””β”€β”€β”€πŸ“‚user
          β”‚β”€β”€β”€πŸ“‚cubit
          β”‚   └──user_cubit.dart
          β”‚β”€β”€β”€πŸ“‚data
          β”‚   β”‚β”€β”€β”€πŸ“‚model
          β”‚   β”‚   │──user.dart
          β”‚   β”‚   └──user.g.dart
          β”‚   β””β”€β”€β”€πŸ“‚provider
          β”‚       β””β”€β”€πŸ“‚remote
          β”‚          └──user_api.dart
          β””β”€β”€β”€πŸ“‚view  
              β”‚β”€β”€πŸ“‚screen
              β”‚  └──user_list_screen.dart
              β””β”€β”€πŸ“‚widget
                 └──status_container.dart

πŸ“‚ Directory Structure (Simple layered architecture version + Bloc)

πŸ“‚lib
 │───main.dart  
 β”‚β”€β”€β”€πŸ“‚common  
 β”‚   β”‚β”€β”€β”€πŸ“‚bloc
 β”‚   β”‚   │──bloc_helper.dart
 β”‚   β”‚   └──generic_bloc_state.dart
 β”‚   β”‚β”€β”€β”€πŸ“‚network
 β”‚   β”‚   │──api_base.dart
 β”‚   β”‚   │──api_result.dart
 β”‚   β”‚   │──api_result.freezed.dart
 β”‚   β”‚   │──dio_client.dart
 β”‚   β”‚   │──dio_exception.dart
 β”‚   β”‚   └──dio_interceptor.dart
 β”‚   β”‚β”€β”€β”€πŸ“‚widget
 β”‚   β”‚   │──date_time_picker.dart
 β”‚   β”‚   │──drop_down.dart
 β”‚   β”‚   │──empty_widget.dart
 β”‚   β”‚   │──popup_menu.dart
 β”‚   β”‚   │──spinkit_indicator.dart
 β”‚   β”‚   └──text_input.dart 
 β”‚   β””β”€β”€β”€πŸ“‚dialog
 β”‚       │──create_dialog.dart
 β”‚       │──delete_dialog.dart
 β”‚       │──progress_dialog.dart
 β”‚       └──retry_dialog.dart
 β”‚β”€β”€β”€πŸ“‚core 
 β”‚   │──api_config.dart
 β”‚   │──app_asset.dart
 β”‚   │──app_extension.dart
 β”‚   │──app_string.dart
 β”‚   │──app_style.dart
 β”‚   └──app_theme.dart
 β””β”€β”€β”€πŸ“‚features
     β”‚β”€β”€β”€πŸ“‚comment
     β”‚    β”‚β”€β”€β”€πŸ“‚bloc
     β”‚    β”‚   │──comment_bloc.dart
     β”‚    β”‚   └──comment_event.dart
     β”‚    β””β”€β”€β”€πŸ“‚data
     β”‚        β”‚β”€β”€β”€πŸ“‚model
     β”‚        β”‚   │──comment.dart
     β”‚        β”‚   └──comment.g.dart
     β”‚        β””β”€β”€β”€πŸ“‚provider
     β”‚            β””β”€β”€πŸ“‚remote
     β”‚               └──comment_api.dart
     β”‚β”€β”€β”€πŸ“‚post
     β”‚    β”‚β”€β”€β”€πŸ“‚bloc
     β”‚    β”‚   └──post_bloc.dart
     β”‚    β”‚   │──post_event.dart
     β”‚    β”‚β”€β”€β”€πŸ“‚data
     β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚model
     β”‚    β”‚   β”‚   │──post.dart
     β”‚    β”‚   β”‚   └──post.g.dart
     β”‚    β”‚   β””β”€β”€β”€πŸ“‚provider
     β”‚    β”‚       β””β”€β”€πŸ“‚remote
     β”‚    β”‚          └──psot_api.dart
     β”‚    β””β”€β”€β”€πŸ“‚view  
     β”‚        β””β”€β”€πŸ“‚screen
     β”‚           │──create_post_screen.dart
     β”‚           │──post_detail_screen.dart
     β”‚           └──post_list_screen.dart
     β”‚β”€β”€β”€πŸ“‚todo
     β”‚    β”‚β”€β”€β”€πŸ“‚bloc
     β”‚    β”‚   │──todo_bloc.dart
     β”‚    β”‚   └──todo_event.dart
     β”‚    β”‚β”€β”€β”€πŸ“‚data
     β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚model
     β”‚    β”‚   β”‚   │──todo.dart
     β”‚    β”‚   β”‚   └──todo.g.dart
     β”‚    β”‚   β””β”€β”€β”€πŸ“‚provider
     β”‚    β”‚       β””β”€β”€πŸ“‚remote
     β”‚    β”‚          └──todo_api.dart
     β”‚    β””β”€β”€β”€πŸ“‚view  
     β”‚        β”‚β”€β”€πŸ“‚screen
     β”‚        β”‚  └──todo_list_screen.dart
     β”‚        β””β”€β”€πŸ“‚widget
     β”‚            │──circle_container.dart
     β”‚            └──todo_list_item.dart
     β””β”€β”€β”€πŸ“‚user
          β”‚β”€β”€β”€πŸ“‚bloc
          β”‚   │──user_bloc.dart
          β”‚   └──user_event.dart
          β”‚β”€β”€β”€πŸ“‚data
          β”‚   β”‚β”€β”€β”€πŸ“‚model
          β”‚   β”‚   │──user.dart
          β”‚   β”‚   └──user.g.dart
          β”‚   β””β”€β”€β”€πŸ“‚provider
          β”‚       β””β”€β”€πŸ“‚remote
          β”‚          └──user_api.dart
          β””β”€β”€β”€πŸ“‚view  
              β”‚β”€β”€πŸ“‚screen
              β”‚  └──user_list_screen.dart
              β””β”€β”€πŸ“‚widget
                 └──status_container.dart

πŸ“‚ Directory Structure (Simple layered architecture version + GetX)

πŸ“‚lib
 │───main.dart  
 β”‚β”€β”€β”€πŸ“‚common  
 β”‚   │───??controller
 β”‚   β”‚   └──base_controller.dart
 β”‚   β”‚β”€β”€β”€πŸ“‚network
 β”‚   β”‚   │──api_base.dart
 β”‚   β”‚   │──dio_client.dart
 β”‚   β”‚   │──dio_exception.dart
 β”‚   β”‚   └──dio_interceptor.dart
 β”‚   β”‚β”€β”€β”€πŸ“‚widget
 β”‚   β”‚   │──date_time_picker.dart
 β”‚   β”‚   │──drop_down.dart
 β”‚   β”‚   │──empty_widget.dart
 β”‚   β”‚   │──popup_menu.dart
 β”‚   β”‚   │──spinkit_indicator.dart
 β”‚   β”‚   └──text_input.dart 
 β”‚   β””β”€β”€β”€πŸ“‚dialog
 β”‚       │──create_dialog.dart
 β”‚       │──delete_dialog.dart
 β”‚       │──progress_dialog.dart
 β”‚       └──retry_dialog.dart
 β”‚β”€β”€β”€πŸ“‚core 
 β”‚   │──api_config.dart
 β”‚   │──app_asset.dart
 β”‚   │──app_extension.dart
 β”‚   │──app_string.dart
 β”‚   │──app_style.dart
 β”‚   └──app_theme.dart
 β””β”€β”€β”€πŸ“‚features
     β”‚β”€β”€β”€πŸ“‚comment
     β”‚    β”‚β”€β”€β”€πŸ“‚controller
     β”‚    β”‚   └──comment_controller.dart
     β”‚    β””β”€β”€β”€πŸ“‚data
     β”‚        β”‚β”€β”€β”€πŸ“‚model
     β”‚        β”‚   │──comment.dart
     β”‚        β”‚   └──comment.g.dart
     β”‚        β””β”€β”€β”€πŸ“‚provider
     β”‚            β””β”€β”€πŸ“‚remote
     β”‚               └──comment_api.dart
     β”‚β”€β”€β”€πŸ“‚post
     β”‚    β”‚β”€β”€β”€πŸ“‚controller
     β”‚    β”‚   └──post_controller.dart
     β”‚    β”‚β”€β”€β”€πŸ“‚data
     β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚model
     β”‚    β”‚   β”‚   │──post.dart
     β”‚    β”‚   β”‚   └──post.g.dart
     β”‚    β”‚   β””β”€β”€β”€πŸ“‚provider
     β”‚    β”‚       β””β”€β”€πŸ“‚remote
     β”‚    β”‚          └──psot_api.dart
     β”‚    β””β”€β”€β”€πŸ“‚view  
     β”‚        β””β”€β”€πŸ“‚screen
     β”‚           │──create_post_screen.dart
     β”‚           │──post_detail_screen.dart
     β”‚           └──post_list_screen.dart
     β”‚β”€β”€β”€πŸ“‚todo
     β”‚    β”‚β”€β”€β”€πŸ“‚controller
     β”‚    β”‚   └──todo_controller.dart
     β”‚    β”‚β”€β”€β”€πŸ“‚data
     β”‚    β”‚   β”‚β”€β”€β”€πŸ“‚model
     β”‚    β”‚   β”‚   │──todo.dart
     β”‚    β”‚   β”‚   └──todo.g.dart
     β”‚    β”‚   β””β”€β”€β”€πŸ“‚provider
     β”‚    β”‚       β””β”€β”€πŸ“‚remote
     β”‚    β”‚          └──todo_api.dart
     β”‚    β””β”€β”€β”€πŸ“‚view  
     β”‚        β”‚β”€β”€πŸ“‚screen
     β”‚        β”‚  └──todo_list_screen.dart
     β”‚        β””β”€β”€πŸ“‚widget
     β”‚            │──circle_container.dart
     β”‚            └──todo_list_item.dart
     β””β”€β”€β”€πŸ“‚user
          β”‚β”€β”€β”€πŸ“‚controller
          β”‚   └──user_controller.dart
          β”‚β”€β”€β”€πŸ“‚data
          β”‚   β”‚β”€β”€β”€πŸ“‚model
          β”‚   β”‚   │──user.dart
          β”‚   β”‚   └──user.g.dart
          β”‚   β””β”€β”€β”€πŸ“‚provider
          β”‚       β””β”€β”€πŸ“‚remote
          β”‚          └──user_api.dart
          β””β”€β”€β”€πŸ“‚view  
              β”‚β”€β”€πŸ“‚screen
              β”‚  └──user_list_screen.dart
              β””β”€β”€πŸ“‚widget
                 └──status_container.dart



🎯 Other flutter projects

Project Name Stars
Japanese restaurant app GitHub stars
Office furniture store app GitHub stars
Ecommerce app GitHub stars
You might also like...

Getx and Dio APi-Integration - Flutter RestApi Integration using Dio

Getx and Dio APi-Integration - Flutter RestApi Integration using Dio

Flutter RestApi Integration using Dio. Click this image to find videos== //Crud

Nov 5, 2022

Music player application for android. It's uses MVVM architecture and Provider & ValueNotifier state management.

Music player application for android. It's uses MVVM architecture and Provider & ValueNotifier state management.

music-player-flutter Flutter music player application which is my personal project published to play store. Project structures are as following,

Jul 10, 2022

Menaclub app for admin using nodejs as backend,RestAPI,provider as statemangement and follows MVVM architecture

menzclub_admin A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started i

Nov 7, 2022

Touranment Manager app using Firebase ,provider and MVVM Architecture

tournament_lotter A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you starte

Nov 25, 2022

βš–οΈ A Flutter Architecture for small/medium/large/big large scale using Provider as State Management with Get It!

βš–οΈ A Flutter Architecture for small/medium/large/big large scale using  Provider as State Management with Get It!

Flutter Provider Architecture Mobile Application Developed in Flutter. Running on both mobile platforms, Android πŸ€– & iOS 🍎 . About this app This app

Jan 4, 2023

Flutter-clean-architecture - A simple flutter project developed with TDD and using Clean Architecture principles.

Clean Architecture This is a study project to practice TDD and a good approach of Clean Architecture for flutter projects. It is based on Reso Coder s

Jul 21, 2022

Provider Demo - Simple Provider using provider update counter and apply a timer also increase and decrease that value by pressing buttons

Provider Demo - Simple Provider using provider update counter and apply a timer also increase and decrease that value by pressing buttons

state_management simple Provider using provider update counter and apply a timer

Feb 2, 2022

This repo is an example of clean architecture using the GetX state-management solution.

This repo is an example of clean architecture using the GetX state-management solution.

GetX Clean Architecture A Flutter Clean Architecture Using GetX. This repo is forked from: https://github.com/phamdinhduc795397/flutter-getx-clean-arc

Jan 3, 2023
Comments
  • What is the best approach for obtaining two different return types response model for our data source?

    What is the best approach for obtaining two different return types response model for our data source?

    Clean Architecture Version (Cubit)/lib/features/comment/data/datasources

    Suppose we have two distinct response models for the same data source, how can we obtain them? Is it necessary to create a new data_source dart file for each new model, or can we organize multiple response models using the same data source?

    1. User Model
    2. UserType Model
    question 
    opened by apptechxonia 14
  • What should I do if the classes in the data/model/ folder are not the ones that need to be displayed on the screen?

    What should I do if the classes in the data/model/ folder are not the ones that need to be displayed on the screen?

    For example, when I retrieve a user from an API, I store the data using a User class. class User { final int? id; final String name; } However, if I need to make other API requests, such as getting the user's role, I would use a Role class to store that data. class Role { final int? roleId; final String roleName; } Finally, I would return a UserVo class (which is typically done in Java) to the screen. class UserVo { final int? id; final String name; final int? roleId; final String roleName; } Since the same class is used in the bloc, screen, and repository, I'm not sure how to make the necessary changes. What is the usual approach for this? Also, I'm using #7 - MVVM Version (Bloc). I look forward to your reply. Thank you.

    question 
    opened by yxm9264 2
  • How to get the same instance of a Cubit in multiple screens using BlocProvider with get_it?

    How to get the same instance of a Cubit in multiple screens using BlocProvider with get_it?

    I have two screens, Screen A and Screen B. To redirect from Screen A to Screen B, I used the go_router implementation. I initialized the bloc in Screen A as shown below:

    MultiBlocProvider(
      providers: [
        BlocProvider(create: (context) => getIt<ScreenOneCubit>()),
        BlocProvider(create: (context) => getIt<GenericFormFieldCubit<FormzInput>>()),
      ],
      child: ScreenA(),
    );
    
    

    
For Screen B: 


    
BlocProvider.value(
      value: getIt<ScreenOneCubit>(),
      child: ScreenB(),
    );
    

    In Di.dart, I registered the ScreenOneCubit using



    getIt.registerFactory(
      () => ScreenOneCubit()
);
    
    

    To redirect from Screen A to Screen B, I used GoRouter.of(context).pushNamed("screenB”). I assumed that the BlocProvider.value in Screen B would get the same cubit instance as Screen A, but I was not expecting the same instance. How can I get the same instance as Screen A in Screen B?

    Requirement: I have a module consisting of 7 screens. Upon clicking a button on the first screen, I make an API call and receive a response that is necessary for screens 4 and 7. To utilize the data, I pass it through each screen. To simplify the process, I wish to use a single Cubit instance to handle this data and easily access it on the relevant page. Can you suggest any approaches to accomplish this?

    Initially, I tried using a singleton-lazy instead of registerFactory to get the Cubit instance. However, after pressing the "Back" button and returning to screen 1, I called the API using the "Next" button, and although the API was called successfully, the BlocListener I was using to listen to the state was no longer triggered. To make the BlocListener listener again on screen 1, I had to close the application. Therefore, I returned to using the registerFactory method.

    question 
    opened by apptechxonia 0
Owner
Sina
Flutter enthusiast
Sina
A basic boilerplate template for starting a Flutter GetX project. GetX, Dio, MVVM, get CLI, Localization, Pagination etc are implemented.

Flutter GetX Template (GetX, Dio, MVVM) This Flutter Template using GetX package for State management, routing and Dependency Injection (bindings). We

Hasan Abdullah 214 Jan 9, 2023
Flutter app using MVVM architecture pattern , dio , provider , intl packages.

News App Simple news application using free news API for fetching realtime data from the internet. Features -Used MVVM architecture pattern. Packages

null 3 Mar 25, 2022
Flutter bloc cubit test knowdge - Flutter bloc cubit test knowdge

Flutter Bloc Simple Api This project is using weather api for featch data and di

Waruna Kaushalya 0 Jan 3, 2022
πŸ’» Flutter clean architecture using the bloc & cubit library for state management

Egymation ?? Β· This application was developed using a well-defined and decoupled architecture, following TDD (test-driven programming) as a working me

Mohaned Zekry 3 Nov 21, 2022
Flutter GetX Template (GetX, Dio, MVVM)

Flutter GetX Template (GetX, Dio, MVVM) This Flutter Template using GetX package for State management, routing and Dependency Injection (bindings). We

null 7 Dec 18, 2022
Flutter mvvm archi - Flutter Advanced Course - Clean Architecture With MVVM

flutter_mvvm_archi A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you start

Namesh Kushantha 0 Jan 8, 2022
will cover the GetX Named Route, GetX Route Transition, GetX Route Result, GetX Route Argument, GetX Route Parameter etc.

getx_playground 1-navigation #2-reactiv A new Fl 3-SimpleStateManagement 4-GetXControllerExample 5- DependencyExample 6-TranslationExample 7-ThemeExam

null 4 Nov 11, 2022
Ouday 25 Dec 15, 2022
A starter kit for beginner learns with Bloc pattern, RxDart, sqflite, Fluro and Dio to architect a flutter project. This starter kit build an App Store app as a example

Flutter Starter Kit - App Store Example A starter kit for beginner learns with Bloc pattern, RxDart, sqflite, Fluro and Dio to architect a flutter pro

kw101 678 Jan 8, 2023
clean architecture and clean code with flutter , with bloc and getx state managment .

example_bloc A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Khaled ElTohamy 6 Aug 22, 2022