A Flutter project that fetches movies from TheMovieDB using Flutter BLoC for state management, Retrofit as a REST client, and Freezed for code generation. The app also employs go_router
for navigation and uses Patrol and Mocktail for testing.
Install FVM (Flutter Version Management)
FVM helps manage multiple Flutter SDK versions and allows for pinning a version per project.
First, ensure you have Dart installed on your machine. If not, follow the official Dart installation guide.
With Dart installed, you can install FVM:
dart pub global activate fvm
Ensure that the path ~/.pub-cache/bin
is in your system's PATH so that you can run fvm
from any terminal window.
Clone the repository
git clone https://github.com/sam-nixplay/movies.git
cd movies
Install Flutter using FVM
fvm install 3.10.5
Switch to the Flutter version for this project (if you have multiple Flutter versions)
fvm global 3.10.5
Get dependencies
flutter pub get
Setting up API Token
The app expects an API token from TheMovieDB to be available in the starting variables when running the flutter app. Modify the launch.json
file (in using VS Code) or set local environment variable and add your API token as follows:
--dart-define=API_TOKEN=YOUR_API_TOKEN
or
{
"name": "movies",
"request": "launch",
"type": "dart",
"args": [
"--dart-define", "API_TOKEN=YOUR_API_TOKEN",
],
},
flutter run --dart-define=API_TOKEN=YOUR_API_TOKEN
flutter test --dart-define=API_TOKEN=YOUR_API_TOKEN
If you want to contribute to this project, please fork the repository, create your feature branch, commit your changes, and open a PR against the main branch.
This project is under the MIT License. See LICENSE.md for more details.
Remember to replace placeholders like your-repo-link
with appropriate values before pushing this README or sharing with others. Also, ensure the .env
file is added to your .gitignore
to avoid accidentally pushing your API token.