Calculator is your essential tool for all your mathematical needs. With a clean and user-friendly interface, this app is designed to make both simple and complex calculations easy and efficient. Whether you're a student, professional, or just need quick calculations on the go, Calculator provides accurate results every time. Powered by Flutter, it offers a smooth and reliable experience across all your devices. Simplify your math with Calculator!
- Standard Calculator: Basic arithmetic operations with a clean, intuitive interface
 - Scientific Calculator: Advanced mathematical functions including trigonometry, logarithms, powers, and more
 - Expression Parsing: Supports complex expressions with proper precedence handling like 
(1+1)*2/2+(8*8) 
- Responsive Design: Optimized for all screen sizes and orientations
 - Dark & Light Themes: Beautiful themes that adapt to system preferences or manual selection
 - Calculation History: Save, search, and replay past calculations
 - Material Design 3: Modern UI following the latest design guidelines
 
- Firebase Integration: Performance monitoring and crash analytics
 - Google Play Integrity API: Enhanced security and fraud prevention
 - State Management: Efficient state management using Provider pattern
 - Local Storage: Persistent settings and history using SharedPreferences
 - Error Handling: Robust error handling for invalid expressions
 - Performance Optimized: Smooth animations and fast calculations
 
- Flutter SDK (>=3.9.2)
 - Dart SDK (comes with Flutter)
 - Android Studio or VS Code with Flutter extensions
 - Java JDK (for Android development)
 - Firebase project (for analytics and crash reporting)
 
- 
Clone the repository
git clone https://github.com/muhammad-fiaz/Calculator-Flutter.git cd Calculator-Flutter - 
Install dependencies
flutter pub get
 - 
Configure Firebase (optional)
- Create a Firebase project at Firebase Console
 - Add Android and iOS apps to your project
 - Download configuration files:
google-services.json→android/app/GoogleService-Info.plist→ios/Runner/
 - Enable services: Analytics, Crashlytics, Performance Monitoring
 
 - 
Run the app
# Debug mode flutter run # Release mode (requires signing config) flutter run --release
 
# Check Android setup
flutter doctor --android-licenses
# Build APK
flutter build apk --release
# Build App Bundle (recommended for Play Store)
flutter build appbundle --release# Install iOS dependencies
cd ios && pod install && cd ..
# Build for iOS
flutter build ios --release# Enable web support
flutter config --enable-web
# Run on web
flutter run -d chrome
# Build for web
flutter build web --release# Windows
flutter config --enable-windows-desktop
flutter run -d windows
# macOS
flutter config --enable-macos-desktop
flutter run -d macos
# Linux
flutter config --enable-linux-desktop
flutter run -d linux- Basic arithmetic: 
+,-,×,÷ - Decimal numbers with proper validation
 - Percentage calculations
 - Parentheses for grouping: 
(,) 
- Trigonometry: 
sin,cos,tan(supports both radians and degrees) - Logarithms: 
ln(natural log),log(base 10) - Powers: 
x²,x³,xʸ,√x - Advanced: 
x!(factorial),1/x(reciprocal) - Constants: 
π(pi),e(Euler's number) 
(2 + 3) × 4 = 20
sin(30°) = 0.5
log(100) = 2
2³ + √16 = 12
5! = 120
- Clean, bright interface
 - High contrast for readability
 - Material Design 3 color system
 
- Easy on the eyes
 - Battery-friendly for OLED displays
 - Consistent with system dark mode
 
- Automatically follows system settings
 - Seamless transitions between modes
 
- Persistent Storage: All calculations are saved locally
 - Search Functionality: Find specific calculations quickly
 - Filter by Mode: View standard or scientific calculations
 - Statistics: Track usage patterns and calculation frequency
 - Export: Export history for backup (coming soon)
 
- Performance Monitoring: Track app performance and optimization
 - Crash Reporting: Automatic crash detection and reporting
 - Usage Analytics: Understand feature usage patterns
 
- Provider Pattern: Clean separation of business logic and UI
 - Multiple Providers: Separate providers for calculator, history, and theme
 - Reactive UI: Automatic UI updates when state changes
 
lib/
├── main.dart                 # App entry point
├── providers/               # State management
│   ├── calculator_provider.dart
│   ├── history_provider.dart
│   └── theme_provider.dart
├── screens/                 # UI screens
│   ├── main_screen.dart
│   ├── calculator_screen.dart
│   ├── history_screen.dart
│   └── settings_screen.dart
└── widgets/                 # Reusable components
    ├── calculator_button.dart
    └── calculator_display.dart
The project includes pre-configured Android signing for release builds:
- Keystore Location: 
android/app/upload-keystore.jks - Signing Properties: 
android/app/signing.properties(gitignored for security) - Configuration: Automatically loaded in 
android/app/build.gradle.kts 
The signing configuration is already set up. For custom keystores:
- 
Generate new keystore:
cd android/app keytool -genkey -v -keystore your-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias your-alias - 
Update signing.properties:
storeFile=your-keystore.jks storePassword=your-store-password keyAlias=your-alias keyPassword=your-key-password
 - 
Update build.gradle.kts if needed (already configured)
 
# Debug builds
flutter build apk                    # Android APK (debug)
flutter build ios --debug           # iOS (debug)
flutter build web                   # Web (debug)
# Release builds
flutter build apk --release         # Android APK (signed)
flutter build appbundle --release   # Android App Bundle (recommended)
flutter build ios --release         # iOS (signed)
flutter build web --release         # Web (production)
# Platform-specific
flutter build windows --release     # Windows
flutter build macos --release       # macOS
flutter build linux --release       # Linux- 
Build App Bundle:
flutter build appbundle --release
 - 
Upload to Play Console:
- Go to Google Play Console
 - Create new release
 - Upload 
build/app/outputs/bundle/release/app-release.aab 
 - 
Configure Play Integrity (already integrated):
- Enable API in Google Cloud Console
 - Configure integrity tokens in Play Console
 
 
- 
Build for iOS:
flutter build ios --release
 - 
Archive in Xcode:
- Open 
ios/Runner.xcworkspace - Product → Archive
 - Upload to App Store Connect
 
 - Open 
 
- 
Build web:
flutter build web --release
 - 
Deploy to hosting:
firebase deploy --only hosting # or upload build/web contents to your web server 
import 'package:calculator/play_integrity_service.dart';
// Check device integrity
bool isTrustworthy = await PlayIntegrityService.isDeviceTrustworthy();
// Get detailed integrity information
String details = await PlayIntegrityService.getIntegrityDetails();- Device Integrity: Detects rooted/jailbroken devices
 - App Recognition: Verifies app authenticity
 - Fraud Prevention: Protects against unauthorized modifications
 - Compliance: Helps meet security requirements
 
The app uses flutter_launcher_icons to generate launcher icons for all platforms from a single source image. The current configuration in pubspec.yaml:
flutter_launcher_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/images/logo.png"
  min_sdk_android: 21
  web:
    generate: true
    image_path: "assets/images/logo-web.png"
    background_color: "#ffffff"
    theme_color: "#ffffff"
  windows:
    generate: true
    image_path: "assets/images/logo.ico"
    icon_size: 48
  macos:
    generate: true
    image_path: "assets/images/logo.png"Place the following files in the assets/images/ directory:
- Android & iOS: 
logo.png(1024x1024px recommended) - Web: 
logo-web.png(512x512px recommended, can be transparent) - Windows: 
logo.ico(48x48px or larger, ICO format) - macOS: 
logo.png(same as Android/iOS, PNG format) 
- Replace the logo files in 
assets/images/with your new logo files - Update file paths in 
pubspec.yamlif filenames change - Regenerate icons by running:
dart run flutter_launcher_icons
 
- Generates multiple icon sizes (hdpi, mdpi, xhdpi, xxhdpi, xxxhdpi)
 - Creates 
ic_launcher.pngandlauncher_icon.pngin each density folder - Minimum SDK: API 21 (Android 5.0)
 
- Generates 20+ different icon sizes for all Apple devices
 - Creates icons from 20x20px to 1024x1024px
 - Updates 
Contents.jsonin the asset catalog 
- Generates 
Icon-192.png,Icon-512.pngfor PWA - Creates 
Icon-maskable-192.png,Icon-maskable-512.pngfor adaptive icons - Updates 
manifest.jsonwith icon references - Sets background and theme colors
 
- Generates 
app_icon.icoin the Windows runner resources - Icon size: 48x48px (configurable)
 - Used for desktop shortcuts and taskbar
 
- Generates multiple PNG sizes from 16x16px to 1024x1024px
 - Creates icons for dock, menu bar, and system preferences
 - Updates 
Contents.jsonin the macOS asset catalog 
- Use PNG format for transparency support
 - Ensure logos have sufficient padding (at least 10% margin)
 - Test on actual devices after generation
 - For iOS, avoid pure white logos (use a colored background)
 - For web, consider both masked and unmasked versions
 
# Run all tests
flutter test
# Run tests with coverage
flutter test --coverage
# Run specific test file
flutter test test/calculator_provider_test.dart
# Run tests in watch mode (re-runs on file changes)
flutter test --watch
# Run integration tests
flutter test integration_test/# Generate coverage report
flutter test --coverage
# View coverage report (requires lcov)
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html# Analyze code for issues
flutter analyze
# Format code
dart format .
# Check for unused files
flutter pub run dart_code_metrics:metrics check-unused-files lib
# Run all quality checks
flutter analyze && flutter testAndroid Build Fails
# Clean and rebuild
flutter clean
flutter pub get
flutter build apk --debug
# Check Java version
java -version
# Accept Android licenses
flutter doctor --android-licensesiOS Build Fails
# Clean iOS build
cd ios && rm -rf Pods/ Podfile.lock && cd ..
flutter clean
flutter pub get
cd ios && pod install && cd ..
flutter build iosFirebase Configuration Issues
# Check Firebase config files exist
ls android/app/google-services.json
ls ios/Runner/GoogleService-Info.plist
# Re-download Firebase config if missing
# Go to Firebase Console → Project Settings → Your appsApp Crashes on Startup
- Check device logs: 
flutter logs - Verify Firebase configuration
 - Check for missing permissions
 - Ensure minimum SDK requirements are met
 
Calculation Errors
- Check expression syntax
 - Verify mathematical operations are supported
 - Review error logs in debug console
 
Database Issues
- Clear app data to reset local database
 - Check available storage space
 - Verify database file permissions
 
# View device logs
flutter logs
# Run in verbose mode
flutter run --verbose
# Check Flutter doctor
flutter doctor -v
# Clean all build artifacts
flutter clean
rm -rf pubspec.lock
flutter pub get- Slow startup: Check Firebase initialization
 - UI lag: Profile with Flutter DevTools
 - Memory issues: Monitor with Android Profiler/iOS Instruments
 - Battery drain: Check background services
 
- Test Coverage: Target >80%
 - Code Analysis: Zero flutter analyze warnings
 - Platform Support: 6 platforms (Android, iOS, Web, Windows, macOS, Linux)
 
- Startup Time: <2 seconds (cold start)
 - Memory Usage: <50MB (average)
 - Battery Impact: Minimal background usage
 - Smooth Animations: 60 FPS target
 
- Code Obfuscation: Enabled in release builds
 - Certificate Pinning: Firebase security
 - Play Integrity: Device verification
 - Secure Storage: Encrypted local data
 
- ✅ Android (API 21+)
 - ✅ iOS (iOS 12+)
 - ✅ Windows (Windows 10+)
 - ✅ macOS (macOS 10.14+)
 - ✅ Linux (Ubuntu 18.04+)
 - ✅ Web (Chrome, Firefox, Safari)
 
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
 - Create a feature branch: 
git checkout -b feature/amazing-feature - Commit your changes: 
git commit -m 'Add amazing feature' - Push to the branch: 
git push origin feature/amazing-feature - Open a Pull Request
 
- Follow Dart and Flutter conventions
 - Use 
flutter analyzeto check for issues - Format code with 
dart format - Write tests for new features
 
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
If you found this project helpful, please consider:
- ⭐ Starring the repository
 - 🐛 Reporting bugs
 - 💡 Suggesting new features
 - 🤝 Contributing to the code
 
Made with ❤️ using Flutter




