Local Setup
This guide will walk you through setting up and running the Flutter News App Mobile Client on your local machine.
-
Prerequisites
Before you begin, you must have the Flutter SDK installed on your system. To ensure you are using the most up-to-date and accurate installation instructions, we recommend following the official guide directly from the Flutter team.
- Flutter SDK: Please follow the Official Flutter Installation Guide for your specific operating system.
-
Download the Latest Release
Download the source code of the latest release from the GitHub releases page for the Mobile Client:
- Mobile Client: https://github.com/flutter-news-app-full-source-code/flutter-news-app-mobile-client-full-source-code/releases/latest
After downloading and extracting the archive, navigate into the project directory.
-
Install Dependencies
Fetch all the required Dart and Flutter packages for the project:
Terminal window flutter pub get -
Configure the Environment
The mobile client uses compile-time variables to configure its environment. This allows you to easily switch between mock data, a local API, or a live production API without changing the code.
You can specify the environment by passing a
--dart-defineflag to theflutter runcommand.- Demo (Default): Runs the app with in-memory mock data. No backend API is required, making it perfect for focusing on UI changes and component testing.
Terminal window flutter run - Development: Connects the app to a locally running instance of the API server.
Terminal window flutter run --dart-define=APP_ENVIRONMENT=development - Production: Connects the app to your live, deployed backend API. You must also provide the base URL for your API.
Terminal window flutter run --dart-define=APP_ENVIRONMENT=production --dart-define=BASE_URL=https://your.api.com
- Demo (Default): Runs the app with in-memory mock data. No backend API is required, making it perfect for focusing on UI changes and component testing.
-
Run the Application
Start the application using one of the commands from the previous step. Ensure you have a simulator/emulator running or a physical device connected.
For example, to run in
demomode:Terminal window flutter runThe application will now launch on your selected device.