Skip to content

Folarin-Isaac/notes-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secure Notes App

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.

🚀 Features

Core Functionality

  • 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

Technical Highlights

  • 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

📱 Screenshots

The app consists of three main screens:

  1. Login Screen - Secure authentication with validation
  2. Notes Screen - List of notes with logout functionality
  3. Device Info Screen - Native device information display

🏗️ Architecture

Clean Architecture Layers

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

State Management

  • Riverpod: For dependency injection and state management
  • StateNotifier: For complex state logic
  • Provider: For dependency injection

🛠️ Setup Instructions

Prerequisites

  • Flutter SDK (3.9.0 or later)
  • Dart SDK (3.0.0 or later)
  • Android Studio / VS Code
  • iOS development setup (for iOS builds)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd notes_app
  2. Install dependencies

    flutter pub get
  3. Generate mock files for testing

    flutter pub run build_runner build
  4. Run the application

    flutter run

Platform-Specific Setup

Android

  • Minimum SDK: 21
  • Target SDK: 34
  • No additional setup required

iOS

  • Minimum iOS version: 12.0
  • Requires Xcode for building
  • No additional setup required

🧪 Testing

Running Tests

# Run all tests
flutter test

# Run tests with coverage
flutter test --coverage

# Run specific test file
flutter test test/unit/auth_repository_test.dart

Test Coverage

The 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 Structure

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

🔐 Authentication

Demo Credentials

For testing purposes, use these credentials:

  • Email: test@sigma-logic.gr
  • Password: password123

Any other credentials will result in an authentication error.

Security Features

  • 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

Native Integration

MethodChannel Implementation

The app demonstrates native platform integration by retrieving device information:

Android (Kotlin)

  • Device model and manufacturer
  • Android version
  • Battery level
  • Platform identification

iOS (Swift)

  • Device model
  • iOS version
  • Battery level
  • Platform identification

Implementation Details

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');

🔧 Configuration

Environment Setup

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;
}

Dependencies

Key dependencies include:

  • flutter_riverpod: State management
  • go_router: Navigation and routing
  • flutter_secure_storage: Secure data storage
  • mockito: Testing mocks
  • build_runner: Code generation

🎯 Key Features Demonstration

Authentication Flow

  1. User enters credentials on login screen
  2. Credentials validated against mock authentication
  3. Token stored securely on device
  4. User navigated to protected notes screen
  5. Token checked on app restart for auto-login

Notes Management

  1. Mock API simulates network delay
  2. Notes displayed in an organized list
  3. Pull-to-refresh functionality
  4. Detailed note view in dialog
  5. Error handling with retry mechanism

Device Information

  1. Native code retrieves device details
  2. Real-time battery level monitoring
  3. Platform-specific information display
  4. Error handling for platform failures

🚨 Error Handling

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

🔄 State Management Patterns

Authentication State

class AuthState {
  final bool isLoading;
  final bool isAuthenticated;
  final User? user;
  final String? error;
}

Notes State

class NotesState {
  final bool isLoading;
  final List<Note> notes;
  final String? error;
}

📈 Performance Considerations

  • 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

🐛 Troubleshooting

Common Issues

  1. Build Runner Issues

    flutter pub run build_runner clean
    flutter pub run build_runner build --delete-conflicting-outputs
  2. Dependency Conflicts

    flutter pub deps
    flutter pub upgrade
  3. Platform Issues

    • Ensure proper SDK versions
    • Check platform-specific configurations
    • Verify MethodChannel implementations

Development Notes

Code Quality

  • Follows Effective Dart style guidelines
  • Comprehensive documentation
  • Type-safe implementation
  • Null safety throughout

Testing Strategy

  • Test-driven development approach
  • High test coverage
  • Mock all external dependencies
  • Widget testing for UI validation

Security Considerations

  • No hardcoded secrets
  • Secure storage implementation
  • Proper error message handling
  • Authentication state management

Contributing

When contributing to this project:

  1. Follow the established architecture patterns
  2. Maintain high test coverage
  3. Update documentation as needed
  4. Ensure platform compatibility

📄 License

This project is created for demonstration purposes and showcases Flutter development best practices.


Built with Flutter and modern development practices

About

This is an assessment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors