A production-quality Flutter application showcasing authentication, secure data storage, native platform integration, and comprehensive testing. Built with clean architecture principles and modern state management.
- Secure Authentication: Mock login system with credential validation
- Protected Routes: Authentication-based navigation with route guards
- Notes Management: Display and interact with a list of notes
- Native Integration: Device information retrieved via MethodChannel
- Secure Storage: Token storage using
flutter_secure_storage
- Clean Architecture: Separation of concerns with domain, data, and presentation layers
- State Management: Riverpod for reactive state management
- Navigation: GoRouter with authentication guards
- Testing: Comprehensive unit and widget tests
- Platform Support: Android and iOS with native MethodChannel implementation
The app consists of three main screens:
- Login Screen - Secure authentication with validation
- Notes Screen - List of notes with logout functionality
- Device Info Screen - Native device information display
lib/
├── core/ # Core utilities and constants
│ ├── constants/ # App constants
│ ├── errors/ # Custom error classes
│ ├── network/ # Router configuration
│ └── storage/ # Secure storage service
├── data/ # Data layer
│ ├── datasources/ # API and local data sources
│ ├── models/ # Data models
│ └── repositories/ # Repository implementations
├── domain/ # Domain layer
│ ├── entities/ # Business entities
│ └── repositories/ # Repository interfaces
├── presentation/ # Presentation layer
│ ├── pages/ # UI screens
│ ├── providers/ # Riverpod providers
│ └── widgets/ # Reusable widgets
└── services/ # Additional services
- Riverpod: For dependency injection and state management
- StateNotifier: For complex state logic
- Provider: For dependency injection
- Flutter SDK (3.9.0 or later)
- Dart SDK (3.0.0 or later)
- Android Studio / VS Code
- iOS development setup (for iOS builds)
-
Clone the repository
git clone <repository-url> cd notes_app
-
Install dependencies
flutter pub get
-
Generate mock files for testing
flutter pub run build_runner build
-
Run the application
flutter run
- Minimum SDK: 21
- Target SDK: 34
- No additional setup required
- Minimum iOS version: 12.0
- Requires Xcode for building
- No additional setup required
# Run all tests
flutter test
# Run tests with coverage
flutter test --coverage
# Run specific test file
flutter test test/unit/auth_repository_test.dartThe application includes comprehensive testing:
- Unit Tests: Repository implementations and business logic
- Widget Tests: UI components and user interactions
- Provider Tests: State management logic
- Mock Integration: Proper mocking of dependencies
test/
├── mocks/ # Mock implementations
├── unit/ # Unit tests
│ ├── auth_repository_test.dart
│ ├── notes_repository_test.dart
│ └── providers_test.dart
└── widget/ # Widget tests
├── login_page_test.dart
└── notes_page_test.dart
For testing purposes, use these credentials:
- Email:
test@sigma-logic.gr - Password:
password123
Any other credentials will result in an authentication error.
- Secure token storage using
flutter_secure_storage - Encrypted shared preferences on Android
- Keychain storage on iOS
- Automatic token validation
- Route protection based on authentication state
The app demonstrates native platform integration by retrieving device information:
- Device model and manufacturer
- Android version
- Battery level
- Platform identification
- Device model
- iOS version
- Battery level
- Platform identification
The native integration uses Flutter's MethodChannel to communicate between Dart and native code:
// Dart side
static const MethodChannel _channel = MethodChannel('device_info');
final result = await _channel.invokeMethod('getDeviceInfo');The app uses the following key configurations:
class AppConstants {
static const String appName = 'Secure Notes';
static const String validEmail = 'test@sigma-logic.gr';
static const String validPassword = 'password123';
static const int networkDelay = 1500;
}Key dependencies include:
flutter_riverpod: State managementgo_router: Navigation and routingflutter_secure_storage: Secure data storagemockito: Testing mocksbuild_runner: Code generation
- User enters credentials on login screen
- Credentials validated against mock authentication
- Token stored securely on device
- User navigated to protected notes screen
- Token checked on app restart for auto-login
- Mock API simulates network delay
- Notes displayed in an organized list
- Pull-to-refresh functionality
- Detailed note view in dialog
- Error handling with retry mechanism
- Native code retrieves device details
- Real-time battery level monitoring
- Platform-specific information display
- Error handling for platform failures
The application implements comprehensive error handling:
- Network Errors: Graceful degradation with retry options
- Authentication Errors: Clear user feedback
- Platform Errors: Fallback for MethodChannel failures
- Validation Errors: Real-time form validation
class AuthState {
final bool isLoading;
final bool isAuthenticated;
final User? user;
final String? error;
}class NotesState {
final bool isLoading;
final List<Note> notes;
final String? error;
}- Lazy Loading: Providers are created only when needed
- Memory Management: Proper disposal of controllers and streams
- Network Optimization: Mock delays simulate real-world conditions
- Efficient Rebuilds: Riverpod ensures minimal widget rebuilds
-
Build Runner Issues
flutter pub run build_runner clean flutter pub run build_runner build --delete-conflicting-outputs
-
Dependency Conflicts
flutter pub deps flutter pub upgrade
-
Platform Issues
- Ensure proper SDK versions
- Check platform-specific configurations
- Verify MethodChannel implementations
- Follows Effective Dart style guidelines
- Comprehensive documentation
- Type-safe implementation
- Null safety throughout
- Test-driven development approach
- High test coverage
- Mock all external dependencies
- Widget testing for UI validation
- No hardcoded secrets
- Secure storage implementation
- Proper error message handling
- Authentication state management
When contributing to this project:
- Follow the established architecture patterns
- Maintain high test coverage
- Update documentation as needed
- Ensure platform compatibility
This project is created for demonstration purposes and showcases Flutter development best practices.
Built with Flutter and modern development practices