Skip to content

Local Setup

This guide will walk you through setting up and running the Flutter News App Mobile Client on your local machine.

  1. 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.

  2. Download the Latest Release

    Download the source code of the latest release from the GitHub releases page for the Mobile Client:

    After downloading and extracting the archive, navigate into the project directory.

  3. Install Dependencies

    Fetch all the required Dart and Flutter packages for the project:

    Terminal window
    flutter pub get
  4. 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-define flag to the flutter run command.

    • 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
  5. 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 demo mode:

    Terminal window
    flutter run

    The application will now launch on your selected device.