Local Setup
This guide will walk you through setting up and running the Flutter News App Web Dashboard on your local machine.
-
Prerequisites
Before you begin, ensure you have the following software installed on your system:
- Flutter SDK: Version
3.8.0
or higher. Make sure you have configured it for web development by runningflutter config --enable-web
.
- Flutter SDK: Version
-
Clone the Repository
Open your terminal, navigate to your desired workspace directory, and clone the web dashboard repository:
Terminal window git clone https://github.com/flutter-news-app-full-source-code/flutter-news-app-web-dashboard-full-source-code.gitcd flutter-news-app-web-dashboard-full-source-code -
Install Dependencies
Fetch all the required Dart and Flutter packages for the project:
Terminal window flutter pub get -
Configure the Environment
The dashboard can be run in different environments, allowing you to connect it to a live API, a local API, or run it with mock data for UI development.
- Open the file
lib/main.dart
. - Locate the
appEnvironment
constant. - Set its value to one of the following:
AppEnvironment.demo
: Runs the dashboard with in-memory mock data. No backend API is required. This is great for testing UI components.AppEnvironment.development
: Connects the dashboard to a locally running instance of the API server (typically athttp://localhost:8080
).AppEnvironment.production
: Connects the dashboard to your live, deployed backend API.
lib/main.dart // Use `AppEnvironment.demo` to run with in-memory data (no API needed).// Use `AppEnvironment.development` to connect to a local backend API.// Use `AppEnvironment.production` to connect to a live backend API.const appEnvironment = AppEnvironment.demo; - Open the file
-
Run the Development Server
Start the Flutter development server, targeting the Chrome browser:
Terminal window flutter run -d chromeThe web dashboard will now be running and accessible in your Chrome browser.