๐Ÿ’ฑ Flutterwave Exchange Rate App

A Flutter application that fetches CAD to NGN exchange rates from the Flutterwave API and automatically updates every hour using a cron job.

Flutter Dart License

๐ŸŒŸ Features

  • Real-time Exchange Rates: Fetches current CAD to NGN exchange rates from Flutterwave API
  • Automatic Updates: Cron job runs every hour to check for the latest rates
  • Currency Converter: Interactive converter between CAD and NGN
  • Caching: Stores exchange rates locally for offline access
  • Modern UI: Beautiful Material Design interface
  • Cross-platform: iOS and Android support
  • Real-time API Integration: Uses actual exchange rates from Flutterwave

๐Ÿ“ฑ Screenshots

The app features a modern, intuitive interface with:

  • Current exchange rate display
  • Real-time currency conversion
  • Automatic hourly updates
  • Offline functionality with cached rates

๐Ÿš€ Quick Start

Prerequisites

  • Flutter SDK (version 3.0.0 or higher)
  • Dart SDK
  • Android Studio / VS Code with Flutter extensions
  • iOS development setup (for iOS deployment)

Installation

  1. Clone the repository

    git clone https://github.com/lagrandecode/flutterwave_exchange_rate.git
    cd flutterwave_exchange_rate
  2. Install dependencies

    flutter pub get
  3. Run the application

    # For development
    flutter run
    
    # Or use the provided script
    ./run_app.sh

๐Ÿ”ง API Integration

The app integrates with the Flutterwave API endpoint:

https://api.flutterwave.com/v3/transfers/rates?amount=1&destination_currency=NGN&source_currency=CAD

API Token: FLWSECK_TEST-77773752bc30f0a99af74caab64187d5-X

Rate Calculation

The app uses real-time exchange rates from the Flutterwave API:

  • Dynamic Rates: Fetches current market rates
  • Hourly Updates: Automatically refreshes every hour
  • Offline Support: Uses cached rates when offline

๐Ÿ“ฑ Platform Support

iOS

  • Minimum iOS version: 12.0
  • Supports iPhone and iPad
  • Automatic code signing

Android

  • Minimum Android version: API 21 (Android 5.0)
  • Supports all Android devices
  • Internet permissions included

๐Ÿ—๏ธ Project Structure

lib/
โ”œโ”€โ”€ main.dart                 # App entry point
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ exchange_rate.dart    # Exchange rate data model
โ”œโ”€โ”€ services/
โ”‚   โ””โ”€โ”€ exchange_rate_service.dart  # API service and cron job
โ”œโ”€โ”€ screens/
โ”‚   โ””โ”€โ”€ home_screen.dart      # Main UI screen
โ””โ”€โ”€ config/
    โ””โ”€โ”€ api_config.dart       # API configuration

๐Ÿงช Testing

API Test

dart test_api.dart

Unit Tests

flutter test

Manual Testing

  1. Launch the app
  2. Check initial rate fetch
  3. Test currency conversion
  4. Verify hourly updates

๐Ÿ“ฆ Dependencies

The app uses the following key dependencies:

  • http: For API requests to Flutterwave
  • cron: For scheduling hourly rate updates
  • provider: For state management
  • shared_preferences: For local caching
  • intl: For currency formatting

๐Ÿ”„ Cron Job Details

  • Schedule: Every hour at minute 0 (0 * * * *)
  • Function: Automatically fetches latest exchange rate
  • Caching: Stores rates locally using SharedPreferences
  • Manual Refresh: Available via refresh button

๐Ÿš€ Deployment

iOS Device Deployment

  1. Build for iOS

    flutter build ios --release
  2. Deploy using Xcode

    open ios/Runner.xcworkspace

    Then select your device and click Run.

  3. Or use the deployment script

    ./deploy_to_device.sh

Android Deployment

  1. Build APK

    flutter build apk --release
  2. Install on device

    flutter install

๐Ÿ” Troubleshooting

Common Issues

  1. API Connection Issues

    • Check internet connection
    • Verify API token is valid
    • Check Flutterwave API status
  2. Build Issues

    flutter clean
    flutter pub get
  3. Cron Job Not Working

    • Check app permissions
    • Verify the app is not being killed by the system

Debug Information

The app logs important events:

  • API calls and responses
  • Cron job triggers
  • Error messages
  • Rate updates

๐Ÿ” Security Notes

  • The API token is currently hardcoded for testing
  • For production, consider using environment variables or secure storage
  • The app uses HTTPS for all API communications

๐Ÿ“ˆ Future Enhancements

  • Support for more currency pairs
  • Historical rate charts
  • Push notifications for rate changes
  • Offline mode improvements
  • Multiple API provider support

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Oluwaseun Ogunmolu

๐Ÿ™ Acknowledgments

  • Flutterwave for providing the exchange rate API
  • Flutter team for the amazing framework
  • The Flutter community for excellent packages

โญ Star this repository if you find it helpful!