The application follows the Clean Architecture principles. It utilizes the BLoC pattern for state management and includes unit testing for robustness.
crypto_app_sample.1.mp4
To integrate the Real-time Price Update feature into your Flutter application, follow these steps:
-
Run Flutter Pub Get:
- Run the following command in your terminal to fetch the newly added dependencies:
flutter pub get
- Run the following command in your terminal to fetch the newly added dependencies:
-
Generate Code:
- Use the following command to generate the necessary code files:
flutter pub run build_runner build --delete-conflicting-outputs
- Use the following command to generate the necessary code files:
The Crypto Pairs feature facilitates fetching cryptocurrency pairs and managing users' favorite pairs. It employs a structured architecture consisting of layers for data handling, domain logic, and presentation.
- Pair Model: Defines the structure for representing cryptocurrency pairs.
- Pairs Repository Implementation: Handles data operations related to fetching crypto pairs.
- Favourite Repository Implementation: Manages data operations for user's favorite pairs.
- Pairs Remote API Service: Communicates with remote API to fetch cryptocurrency pairs.
- Favourite Pairs Local Data Source: Provides access to local storage for storing user's favorite pairs.
- Pairs Repository: Abstracts data operations related to crypto pairs.
- Favourite Pairs Repository: Abstracts data operations for managing user's favorite pairs.
- Pairs Use Cases + Implementation: Contains business logic for handling crypto pairs.
- Favourite Pairs Use Cases + Implementation: Includes logic for managing user's favorite pairs.
- Utilizes the BLoC pattern for managing state related to crypto pairs and favorite pairs.
- Presents user interface components for interacting with the Crypto Pairs feature.
-
Remote Data Service vs Data Source:
- We utilize a remote data service instead of a data source because it allows us to fetch real-time data from an external API. This ensures that the application remains up-to-date with the latest cryptocurrency pair information.
-
Local Storage for Favorite Pairs:
- In this simple demo application, we employ local storage to store user's favorite pairs. This decision is made to keep the demo lightweight and straightforward. The BLoC state management library aids in managing and updating this local storage efficiently.
This feature enhances the application by enabling users to search for cryptocurrency pairs based on the base asset or coin. It utilizes the BLoC pattern for presentation layer management.
The Pairs Search feature builds upon the existing functionality provided by the Pairs Fetch feature. Users can search for specific cryptocurrency pairs without the need for additional API calls, leveraging the already-fetched list of pairs.
The search functionality utilizes the list of pairs fetched by the Pairs Fetch feature. We can conduct searches without relying on additional API calls by mapping each pair with real-time WebSocket stream response. This approach optimizes performance and reduces network overhead.
A potential improvement would be to check if there's no data already fetched before initiating a search. In such cases, we can make an initial API call with the initial keystroke of the search term. Subsequent searches can then be conducted locally without additional API calls, as the API returns the same 312 symbols every time.
This feature enhances the application by providing real-time updates for cryptocurrency prices. It utilizes web sockets to fetch price updates and incorporates the BLoC pattern for presentation layer management.
The Real-time Price Update feature leverages web socket technology to fetch real-time price updates and seamlessly integrates with the existing architecture.
- Price Update Model: Defines the structure for representing real-time price updates.
- Price Update WebSocket Source: Communicates with the Mark Price web socket to retrieve real-time price updates for all coins.
- Price Update Use Cases + Implementation: Contains business logic for handling real-time price updates.
- Utilizes the BLoC pattern for the presentation layer, ensuring efficient state management for real-time price updates.
The Real-time Price Update feature utilizes the Mark Price web socket to retrieve prices for all coins. By mapping this information with the list of pairs already fetched from the Pairs Fetch feature, users can access real-time price updates seamlessly within the application.