74 lines
1.7 KiB
Markdown
74 lines
1.7 KiB
Markdown
# Instructions and Console Commands for Building and Running the App
|
||
|
||
## 📌 Environment Setup
|
||
The project uses `.env` files to manage environment configurations. Available files:
|
||
|
||
- `.env` – for the production environment
|
||
- `.env_dev` – for the development environment
|
||
|
||
Before running or building the app, ensure that the appropriate `.env` file is correctly configured.
|
||
|
||
---
|
||
|
||
## 🔧 Code Generation
|
||
Before running the app or creating a build, generate the required code:
|
||
|
||
```sh
|
||
flutter pub get
|
||
flutter pub run build_runner build --delete-conflicting-outputs
|
||
```
|
||
|
||
To enable automatic code generation on file changes, use:
|
||
|
||
```sh
|
||
dart run build_runner build --delete-conflicting-outputs
|
||
```
|
||
|
||
---
|
||
|
||
## 🚀 Running the App
|
||
|
||
### ▶️ Running in Visual Studio Code
|
||
Open the project in VS Code and use the `launch.json` configuration, or run the following command:
|
||
|
||
```sh
|
||
flutter run --flavor dev -t lib/main_dev.dart
|
||
```
|
||
|
||
For the production environment:
|
||
|
||
```sh
|
||
flutter run --flavor prod
|
||
```
|
||
|
||
### ▶️ Running in Android Studio
|
||
1. Open the project in **Android Studio**.
|
||
2. Go to **Edit Configurations**.
|
||
3. Add a new run configuration.
|
||
4. Set `Environment Variable: ENV=.env_dev` for dev or `ENV=.env` for prod.
|
||
5. Run the app via the IDE or using the terminal:
|
||
|
||
```sh
|
||
flutter run --flavor dev -t lib/main_dev.dart
|
||
```
|
||
|
||
---
|
||
|
||
## 📦 Building the App
|
||
|
||
### 📲 Building an App Bundle for Release
|
||
|
||
```sh
|
||
flutter build appbundle --flavor prod --target-platform android-arm,android-arm64,android-x64
|
||
```
|
||
|
||
### 📲 Building an APK for Testing
|
||
|
||
```sh
|
||
flutter build apk --flavor dev -t lib/main_dev.dart
|
||
```
|
||
|
||
These commands ensure the app is correctly set up and built according to the selected environment.
|
||
|
||
---
|