Documentation Index
Fetch the complete documentation index at: https://mintlify.com/khode-io/nest-dart/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This example demonstrates a complete Flutter application built with Nest Dart, featuring:- Modular architecture with dependency injection
- Route management with go_router integration
- Service-based architecture for API calls
- State management with Provider
- Multiple modules with shared dependencies
Project Structure
Getting Started
Module Organization
App Module
The root module imports all feature modules and initializes the app:lib/main.dart
Core Module
Provides shared services across the application:lib/modules/core_module.dart
The
exports property makes these services available to other modules that import CoreModule.Todo Module
Encapsulates the todo feature with routes, services, and providers:lib/modules/todo_module.dart
Route Setup
Nest Flutter integrates seamlessly with go_router:lib/main.dart
Key Points
Modular.router()collects routes from all modules- Each module can define a
routePrefixfor its routes - Routes automatically inherit the module’s prefix
- Full go_router features available (parameters, guards, etc.)
Service Implementation
TheTodoService demonstrates dependency injection and API integration:
lib/services/todo_service.dart
Using Services in Widgets
Services are accessed through the Provider pattern:lib/views/todo_list_view.dart
Data Model
TheTodo model with JSON serialization:
lib/models/todo.dart
Key Concepts Demonstrated
Dependency Injection
Services are registered in modules and injected where needed, making testing and maintenance easier.
Module Imports
TodoModule imports CoreModule to access shared services like HTTP client and preferences.
Route Prefixes
Each module defines its own route prefix, creating clean URL structure automatically.
Service Abstraction
Abstract TodoService allows easy swapping of implementations for testing or different backends.
Next Steps
- Explore the Module System for advanced patterns
- Learn about Dependency Injection
- Check out the Frog Backend Example for a complete backend
- See Flutter Integration for more Flutter-specific features