Skip to content

This Flutter application is a project that enables users to manage top-up beneficiaries and perform top-up transactions for their UAE phone numbers.

Notifications You must be signed in to change notification settings

azlaan95/free_charge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Top-Up App

This Flutter application is a technical assessment project that enables users to manage top-up beneficiaries and perform top-up transactions for their UAE phone numbers.

Project Overview

The app implements the following key features:

  • Beneficiary Management: Users can add and view up to 5 active beneficiaries for phone top-ups.
  • Top-Up Transactions: Users can top-up a beneficiary's phone number with a selected amount, subject to various business rules.
  • Transaction Limits: The application enforces different top-up limits based on the user's verification status and overall monthly usage.
  • Transaction Fees: A standard fee is applied to each top-up transaction.

Architecture and Design

This project is built using Clean Architecture principles, ensuring a clear separation of concerns, scalability, and maintainability. The codebase is divided into three main layers:

  • Domain: Contains the core business logic, including entities, use cases, and repository interfaces. This layer is independent of any UI or data-sourcing frameworks.
  • Data: Implements the repository interfaces defined in the domain layer. It is responsible for fetching data from data sources (either local or remote) and managing the data flow.
  • Presentation: This layer is responsible for the UI and user interaction. It uses the BLoC pattern for state management, ensuring a reactive and predictable UI.

Technologies and Libraries

  • State Management: flutter_bloc for predictable state management.
  • Local Database: drift for persistent storage of user and transaction data.
  • Local Storage: shared_preferences for simple key-value storage.
  • Networking: dio for making HTTP requests (with a mocked implementation for this project).

Setup and Installation

Prerequisites

  • Flutter SDK (version 3.35.7 is recommended).

Using FVM (Flutter Version Management)

This project is configured to use FVM to ensure a consistent Flutter version. If you do not have Flutter 3.35.7 installed, you can use FVM to run the project.

  1. Activate FVM:

    dart pub global activate fvm
  2. Run the app using FVM:

    fvm flutter run

Without FVM

If you are not using FVM, ensure you have Flutter version 3.35.7 installed.

  1. Install dependencies:

    flutter pub get
  2. Run the app:

    flutter run

Assumptions

  • Mocked Backend: Since no backend was provided, the application uses a mocked data source for all data-related operations. The login feature, in particular, uses mock data and is not fully implemented with validations, as it was not part of the user story.
  • Local Data Source: To demonstrate data persistence and business logic, a LocalDataSource using the drift database has been implemented to simulate data fetching and storage.
  • API Integration Example: The auth_remote_data_source_impl.dart file is included to demonstrate how REST API integration would be structured if a backend were available.

Running Unit Tests

Comprehensive unit tests have been written to ensure the correctness and reliability of the application's logic. To run the tests, use the following command:

flutter test

The tests cover the following areas:

  • Domain Layer:

    • Use Cases: Tests for all business rules, including top-up limits, beneficiary restrictions, and transaction fees. The use cases for auth, topup, and beneficiary are thoroughly tested.
  • Data Layer:

    • Repositories: Tests for the UserRepository and TopUpRepository to ensure that data is correctly handled and mapped between the data sources and the domain layer.
  • Presentation Layer:

    • BLoCs: Tests for the HomeBloc, TopUpBloc, and AddBeneficiaryBloc to verify the state management logic, event handling, and interactions with the use cases.

About

This Flutter application is a project that enables users to manage top-up beneficiaries and perform top-up transactions for their UAE phone numbers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages