A production-level Flutter application built with GetX state management, featuring a clean architecture and industry-standard folder structure.
- GetX State Management - Reactive state management with controllers and bindings
- Clean Architecture - Modular folder structure following industry standards
- JSONPlaceholder API Integration - Full CRUD operations on posts
- Reactive UI - Automatic UI updates with Obx() and Rx variables
- Navigation - GetX route management with transitions
- Error Handling - Comprehensive error handling and loading states
- Responsive Design - Material Design 3 with modern UI components
- Home Screen - Displays list of posts with pull-to-refresh
- Detail Screen - Shows individual post details with edit/delete functionality
lib/
βββ main.dart # App entry point with GetX initialization
βββ app/
β βββ routes/
β β βββ app_pages.dart # GetX route configuration with bindings
β β βββ app_routes.dart # Route constants
β β
β βββ modules/
β β βββ home/
β β β βββ home_view.dart # Home screen UI
β β β βββ home_controller.dart # Home business logic
β β β βββ home_binding.dart # Home dependencies
β β β
β β βββ detail/
β β β βββ detail_view.dart # Detail screen UI
β β β βββ detail_controller.dart # Detail business logic
β β β βββ detail_binding.dart # Detail dependencies
β β
β βββ data/
β β βββ models/
β β β βββ post_model.dart # Post data model with JSON serialization
β β βββ providers/
β β βββ api_provider.dart # HTTP API client for JSONPlaceholder
β β
β βββ widgets/
β βββ custom_button.dart # Reusable button component
- Flutter - UI framework
- GetX - State management, navigation, and dependency injection
- HTTP - API communication
- JSON Serialization - Data model serialization
- Material Design 3 - Modern UI components
The app uses JSONPlaceholder for testing:
GET /posts- Fetch all postsGET /posts/{id}- Fetch single postPOST /posts- Create new postPUT /posts/{id}- Update existing postDELETE /posts/{id}- Delete post
- Flutter SDK (latest stable version)
- Dart SDK
- Android Studio / VS Code
-
Clone the repository
git clone <repository-url> cd flutter_app
-
Install dependencies
flutter pub get
-
Generate JSON serialization code
flutter packages pub run build_runner build
-
Run the app
flutter run
The app uses GetX for reactive state management:
// Observable variables automatically update UI
final RxList<Post> posts = <Post>[].obs;
final RxBool isLoading = false.obs;
// UI automatically rebuilds when data changes
Obx(() => ListView.builder(
itemCount: controller.posts.length,
itemBuilder: (context, index) => PostCard(controller.posts[index]),
))Controllers are injected using GetX bindings:
class HomeBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<HomeController>(() => HomeController());
}
}GetX handles navigation with route management:
// Navigate to detail page with data
Get.toNamed('/detail', arguments: post);
// Go back
Get.back();- Posts List - Displays all posts from API
- Pull to Refresh - Refresh posts list
- Create Post - Add new post (FAB)
- Delete Post - Remove posts with confirmation
- Navigate to Detail - Tap post to view details
- Post Details - Full post information display
- Edit Post - Update post title and content
- Delete Post - Remove post with confirmation
- Back Navigation - Return to home screen
- Views - Handle UI only
- Controllers - Manage business logic and state
- Models - Define data structure
- Providers - Handle external data sources
- Automatic UI updates when data changes
- No manual setState() calls needed
- Efficient memory usage
- Controllers are automatically injected
- Easy to test and mock dependencies
- Lazy loading for better performance
- Type-safe navigation
- Automatic route generation
- Transition animations
The app is structured for easy testing:
// Test controller logic
class HomeControllerTest {
test('should fetch posts from API', () async {
final controller = HomeController();
await controller.fetchPosts();
expect(controller.posts.length, greaterThan(0));
});
}dependencies:
flutter:
sdk: flutter
get: ^4.6.6 # State management
http: ^1.2.0 # HTTP client
json_annotation: ^4.9.0 # JSON serialization
dev_dependencies:
json_serializable: ^6.8.0 # Code generation
build_runner: ^2.4.13 # Build tools- β Null Safety - Full Dart null safety implementation
- β Error Handling - Comprehensive error handling and user feedback
- β Loading States - Proper loading indicators
- β Responsive Design - Works on different screen sizes
- β Clean Code - Well-documented and maintainable code
- β Performance - Efficient state management and lazy loading
- β Scalability - Modular architecture for easy expansion
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support and questions:
- Check the GetX documentation
- Review the code comments for implementation details
- Open an issue in the repository
Built with β€οΈ using Flutter and GetX