worldhopper/.serena/memories/suggested_commands.md
2026-01-27 00:56:46 +01:00

3.8 KiB

Suggested Commands

Flutter Development

Running the App

flutter run                    # Run app on connected device/emulator
flutter run -d chrome          # Run on Chrome (web)
flutter run -d macos           # Run on macOS
flutter run --release          # Run in release mode
flutter run --verbose          # Run with verbose logging

Development Tools

flutter doctor                 # Check Flutter installation and dependencies
flutter pub get               # Install/update dependencies
flutter pub outdated          # Check for outdated packages
flutter pub upgrade           # Upgrade packages
flutter clean                 # Clean build artifacts
flutter analyze               # Run static analysis/linting
flutter test                  # Run all tests
flutter test test/widget_test.dart  # Run specific test file
flutter logs                  # Show logs from running app

Code Generation

IMPORTANT: Required after modifying models or providers!

# Generate code for Freezed models and Riverpod providers
flutter pub run build_runner build

# Generate and delete conflicting outputs (recommended)
flutter pub run build_runner build --delete-conflicting-outputs

# Watch mode - automatically regenerate on file changes
flutter pub run build_runner watch

# Clean generated files
flutter pub run build_runner clean

When to run code generation:

  • After creating/modifying any @freezed model classes
  • After creating/modifying any @riverpod providers
  • After adding/changing @JsonSerializable models
  • If you see "undefined" errors for generated classes

Building

flutter build apk             # Build Android APK
flutter build appbundle       # Build Android App Bundle (for Play Store)
flutter build ios             # Build iOS app
flutter build web             # Build web app
flutter build macos           # Build macOS app

Database Operations

# The app uses SQLite - no special commands needed
# Database file location: app data directory (platform-specific)
# Database version is managed by DatabaseHelper

Project-Specific

Dependencies Overview

  • State Management: Riverpod (requires code generation)
  • Models: Freezed (requires code generation)
  • HTTP: Dio
  • Database: sqflite
  • XML Parsing: xml
  • EPUB Reader: flutter_epub_viewer
  • Routing: go_router

Common Development Workflow

# 1. Make changes to models/providers
# 2. Run code generation
flutter pub run build_runner build --delete-conflicting-outputs
# 3. Run the app
flutter run
# 4. Check for issues
flutter analyze

Git Commands

git status                    # Check repository status
git add <file>               # Stage files
git commit -m "message"      # Commit changes
git push                     # Push to remote
git pull                     # Pull from remote
git log --oneline -n 10      # View recent commits

System Utilities (macOS/Darwin)

ls -la                       # List files with details
find . -name "pattern"       # Find files
grep -r "pattern" .          # Search in files
cd <directory>               # Change directory
pwd                          # Print working directory

Debugging

Flutter DevTools

flutter pub global activate devtools  # Install DevTools
flutter pub global run devtools       # Launch DevTools

Logs and Debugging

flutter run --verbose        # Run with verbose output
flutter logs                 # Show logs from running app
adb logcat                   # Android logs (if using adb)

Common Issues

# If build errors persist:
flutter clean
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs

# If device not recognized:
flutter doctor -v
adb devices  # For Android

# If dependencies are conflicting:
flutter pub upgrade --major-versions