Notes application built with Flutter and Firebase.
- Secure Authentication - Email/password login with Firebase Auth
- Real-time Data Sync - Cloud Firestore integration
- Full CRUD Operations - Create, Read, Update, Delete notes
- Clean Architecture - Separation of concerns with proper layering
- State Management - BLoC pattern for predictable state handling
- User-Friendly UI - Material Design 3 with intuitive navigation
- Error Handling - Comprehensive error management with user feedback
- Offline Support - Firestore's built-in offline capabilities
- Security Rules - User-specific data access control
This project follows Clean Architecture principles with clear separation of concerns:
┌─────────────────────────────────────────────────────────────┐
│ PRESENTATION LAYER │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Screens │ │ Widgets │ │ BLoCs │ │
│ │ │ │ │ │ │ │
│ │• AuthScreen │ │• NoteItem │ │• AuthBloc │ │
│ │• NotesScreen│ │• NoteDialog │ │• NotesBloc │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ DATA LAYER │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Repositories │ │ Models │ │
│ │ │ │ │ │
│ │• AuthRepository │◄────────────►│• NoteModel │ │
│ │• NotesRepository│ │ │ │
│ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ DOMAIN LAYER │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────────┐ │
│ │ Entities │ │
│ │ │ │
│ │ • Note │ │
│ └─────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ EXTERNAL SERVICES │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Firebase Auth │ │ Firestore │ │
│ │ │ │ │ │
│ │ • Sign In/Up │ │ • Notes Storage │ │
│ │ • User Session │ │ • Real-time Sync│ │
│ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────┘
User Interaction → Widget → BLoC Event → Repository → Firebase
↓
User Interface ← Widget ← BLoC State ← Repository ← Firebase Response
📁lib/
├── main.dart # App entry point
├── domain/ # Business logic layer
│ └── entities/
│ └── note.dart # Note entity
├── data/ # Data access layer
│ ├── models/
│ │ └── note_model.dart # Firestore data model
│ └── repositories/
│ ├── auth_repository.dart # Authentication operations
│ └── notes_repository.dart # Notes CRUD operations
└── presentation/ # UI layer
├── bloc/
│ ├── auth_bloc.dart # Authentication state management
│ └── notes_bloc.dart # Notes state management
├── screens/
│ ├── auth_screen.dart # Login/Signup UI
│ └── notes_screen.dart # Notes list UI
└── widgets/
├── note_item.dart # Individual note widget
└── note_dialog.dart # Add/Edit note dialog
- Flutter SDK: >= 3.0.0
- Dart SDK: >= 3.0.0
- Firebase Account: Create one here
- IDE: VS Code, Android Studio, or IntelliJ IDEA
git clone https://github.com/josueahadi/notes_app.git
cd notes_appflutter pub get- Go to Firebase Console
- Click "Add project" or "Create a project"
- Enter project name (e.g., "Flutter Notes App")
- Choose whether to enable Google Analytics (optional)
- Click "Create project"
Enable Authentication:
- Navigate to Authentication → Get Started
- Go to "Sign-in method" tab
- Enable "Email/Password" provider
- Click "Save"
Enable Firestore Database:
- Navigate to Firestore Database
- Click "Create database"
- Choose "Test mode" (for development)
- Select a location (e.g., us-central1)
- Click "Done"
For Android:
- Click the Android icon in project overview
- Enter package name:
com.example.notes_app - Download
google-services.json - Place it in
android/app/directory
For iOS:
- Click the iOS icon in project overview
- Enter bundle ID:
com.example.notesApp - Download
GoogleService-Info.plist - Add it to
ios/Runner/in Xcode
android/build.gradle (project level):
buildscript {
ext.kotlin_version = '1.7.10'
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.15' // Add this line
}
}android/app/build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services' // Add this line
android {
compileSdkVersion 33
defaultConfig {
minSdkVersion 21
targetSdkVersion 33
multiDexEnabled true // Add this if needed
}
}- Open
ios/Runner.xcworkspacein Xcode - Right-click "Runner" → "Add Files to Runner"
- Select
GoogleService-Info.plist - Ensure it's added to the Runner target
- Go to Firestore Database → Rules tab
- Replace default rules with:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId}/notes/{noteId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}- Click "Publish"
# Check for any issues
flutter doctor
# Run the app
flutter run
# Build for production
flutter build apk --release # Android
flutter build ios --release # iOS- First Launch: User sees login screen
- Sign Up: New users create account with email/password
- Sign In: Returning users enter credentials
- Auto-Login: App remembers authentication state
- View Notes: All notes displayed in chronological order
- Add Note: Tap "+" button to create new note
- Edit Note: Tap edit icon to modify existing note
- Delete Note: Tap delete icon with confirmation dialog
- Empty State: Helpful message when no notes exist
- Automatic Sync: Changes sync when connection restored
- Local Cache: Notes available offline
- Conflict Resolution: Firebase handles data conflicts
# Unit tests
flutter test
# Integration tests
flutter test integration_test/
# Widget tests
flutter test test/widget_test.dart# Generate coverage report
flutter test --coverage
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html- Firebase Auth: Industry-standard authentication
- Password Requirements: Minimum 6 characters
- Email Validation: Proper email format checking
- Session Management: Secure token handling
- User Isolation: Users can only access their own notes
- Firestore Rules: Server-side access control
- HTTPS: All data transmitted securely
- No Local Storage: Sensitive data not stored locally
// Users can only read/write their own notes
match /users/{userId}/notes/{noteId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}- Modern Aesthetics: Latest Material Design principles
- Responsive Layout: Adapts to different screen sizes
- Accessibility: Screen reader and keyboard navigation support
- Loading States: Visual feedback during operations
- Success Messages: Confirmation of completed actions
- Error Handling: Clear error messages with actionable advice
- Empty States: Helpful guidance when no content exists
- Intuitive Flow: Logical progression through app features
- Back Navigation: Consistent back button behavior
- Deep Linking: Support for direct navigation to specific screens
Create .env file for configuration:
# Firebase Configuration
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_API_KEY=your-api-key
FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.comDevelopment:
flutter run --flavor dev -t lib/main_dev.dartProduction:
flutter run --flavor prod -t lib/main_prod.dart- Efficient Queries: Indexed fields for better performance
- Pagination: Limit query results for large datasets
- Offline Persistence: Enabled by default in Firebase
- Widget Rebuilds: Optimized with BLoC pattern
- Memory Management: Proper disposal of resources
- Bundle Size: Tree-shaking eliminates unused code
# Build release APK
flutter build apk --release
# Build App Bundle (recommended)
flutter build appbundle --release
# Sign the app (configure signing in android/app/build.gradle)# Build for iOS
flutter build ios --release
# Archive in Xcode
# Upload to App Store ConnectExample GitHub Actions workflow:
name: Build and Deploy
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
- run: flutter pub get
- run: flutter test
- run: flutter build apk --release- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Follow coding standards: Use
flutter analyzeanddart format - Write tests: Maintain test coverage above 80%
- Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
- Dart Style Guide: Follow official Dart conventions
- Documentation: Comment complex logic and public APIs
- Testing: Write unit tests for business logic
- Architecture: Maintain clean architecture principles
Build Errors:
# Clean and rebuild
flutter clean
flutter pub get
flutter runFirebase Connection Issues:
- Verify
google-services.json/GoogleService-Info.plistplacement - Check Firebase project configuration
- Ensure internet connectivity
Authentication Errors:
- Verify email/password provider is enabled
- Check Firebase Auth settings
- Review security rules
Firestore Permission Errors:
- Ensure security rules are published
- Verify user authentication status
- Check rule syntax in Firebase Console
# Check Flutter installation
flutter doctor -v
# View logs
flutter logs
# Debug build
flutter run --debug
# Profile performance
flutter run --profileN/A
- Documentation: Flutter Docs
- Firebase Help: Firebase Docs
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Last updated: July 2025