DeepCricket is a Flutter application that provides in-depth cricket analysis powered by the Perplexity AI API. Users can search for information about cricket players, matches, statistics, tournaments, and strategies.
- AI-Powered Cricket Analysis: Get detailed information about any cricket-related query
- Clean and Modern UI: User-friendly interface with a search bar and results display
- Recent Searches: Keep track of your recent searches for quick access
- Error Handling: Robust error handling for API failures and network issues
This application is configured to run on the web platform. Follow these steps to get it running:
- Flutter SDK (latest version recommended)
- Dart SDK (latest version recommended)
- Node.js and npm (for the CORS proxy server)
- A Perplexity API key
- Clone the repository
- Run
flutter pub get
to install dependencies - Make sure your Perplexity API key is set in
lib/config/api_config.dart
When running the app on the web, you'll need to use a CORS proxy server to handle API requests. We've included a simple Node.js proxy server:
-
Install the required Node.js packages:
npm install
-
Start the proxy server:
npm start
The proxy server will run on http://localhost:8080.
-
Make sure the CORS proxy server is running
-
Run the Flutter web app:
flutter run -d chrome
-
Or build for production:
flutter build web
You can configure the app's behavior in lib/config/api_config.dart
:
useProxyForWeb
: Set totrue
to use the CORS proxy for web requests (recommended)perplexityApiUrl
: The direct URL for the Perplexity APIcorsProxyUrl
: The URL for the local CORS proxy serverapiKey
: Your Perplexity API keymodel
: The Perplexity model to usemaxTokens
: Maximum number of tokens to generatetimeoutSeconds
: Timeout duration for API requests
If you encounter issues when running on the web:
- Check the browser console for error messages
- Ensure the CORS proxy server is running
- Verify that
useProxyForWeb
is set totrue
inlib/config/api_config.dart
- Try clearing your browser cache
- Check if your Perplexity API key is valid
The Perplexity API can sometimes take longer than expected to respond, especially for complex cricket queries. The app is configured with the following timeout settings:
- Flutter app timeout: 120 seconds (configurable in
lib/config/api_config.dart
) - CORS proxy server timeout: 300 seconds (5 minutes)
- JavaScript fetch timeout: 120 seconds
If you're still experiencing timeout issues:
- Increase the
timeoutSeconds
value inlib/config/api_config.dart
- Try simpler, more specific queries
- Check if the Perplexity API is experiencing high traffic
- Ensure your internet connection is stable
The app includes an automatic retry mechanism that will attempt to resend failed requests up to 2 times before showing an error message.
This project is licensed under the MIT License - see the LICENSE file for details.
- Perplexity AI for providing the API
- Flutter team for the amazing framework