This is a Flutter application fetch Random number from API, each 10 secs and check if it prime or not.
Before you begin, make sure you have the following installed:
- Flutter SDK
- Dart
- Android Studio or Xcode for emulators
- Git (for cloning the repository)
-
Clone the Repository
git git@github.com:qaysdwekat/flutter_challenge.git cd flutter_challenge -
Run the Application
flutter run
- Note: The app works on iOS, Android, and Web. However, on Web, due to CORS restrictions, the API will always throw an exception unless the server explicitly allows cross-origin requests.
-
Generate Mocks Files Use the following command to generate the necessary Mocks files:
dart run build_runner build
-
Unit & Widget Tests Run the following command to execute the tests:
flutter testTo generate a code coverage report:
flutter test --coverageTo view the HTML coverage report:
genhtml coverage/lcov.info -o coverage/html open coverage/html/index.html # For macOS # or xdg-open coverage/html/index.html # For Linux
⚠️ Make sure you have lcov installed. On macOS you can use:brew install lcov -
Integration Test Run the following command to execute the tests:
flutter test integration_test