Skip to content

Commit 94c5501

Browse files
authored
Merge pull request #33 from webreinvent/feature/dynamic-environment-configurations
Feature->Develop | Added: Dynamic Environment Configurations
2 parents 04b78d4 + 2600435 commit 94c5501

25 files changed

+505
-328
lines changed

.gitignore

-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ migrate_working_dir/
1616
*.iws
1717
.idea/
1818

19-
# VS code
20-
.vscode/
21-
22-
# The .vscode folder contains launch configuration and tasks you configure in
23-
# VS Code which you may wish to be included in version control, so this line
24-
# is commented out by default.
25-
#.vscode/
26-
2719
# Flutter/Dart/Pub related
2820
**/doc/api/
2921
**/ios/Flutter/.last_build_id

.vscode/launch.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"version": "0.2.0",
3+
"inputs": [
4+
{
5+
"id": "option",
6+
"type": "pickString",
7+
"description": "buildMode",
8+
"options": [
9+
"debug",
10+
"profile",
11+
"release"
12+
],
13+
},
14+
],
15+
"configurations": [
16+
{
17+
"name": "develop ${input:option}",
18+
"request": "launch",
19+
"type": "dart",
20+
"flutterMode": "${input:option}",
21+
"args": [
22+
"--dart-define",
23+
"ENV_PATH=assets/env/develop.json",
24+
],
25+
},
26+
{
27+
"name": "staging ${input:option}",
28+
"request": "launch",
29+
"type": "dart",
30+
"flutterMode": "${input:option}",
31+
"args": [
32+
"--dart-define",
33+
"ENV_PATH=assets/env/staging.json",
34+
],
35+
},
36+
{
37+
"name": "production ${input:option}",
38+
"request": "launch",
39+
"type": "dart",
40+
"flutterMode": "${input:option}",
41+
"args": [
42+
"--dart-define",
43+
"ENV_PATH=assets/env/production.json",
44+
],
45+
}
46+
]
47+
}

assets/env/develop.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"app_title": "VaahFlutter",
3+
"app_title_short": "VaahFlutter",
4+
"env_type": "Develop",
5+
"version": "1.0.0",
6+
"build": "1",
7+
"backend_url": "",
8+
"api_url": "",
9+
"firebase_id": null,
10+
"timeout_limit": 20000,
11+
"enable_local_logs": false,
12+
"enable_cloud_logs": false,
13+
"enable_api_log_interceptor": false,
14+
"sentry_config": null,
15+
"push_notifications_service_type": "none",
16+
"internal_notifications_service_type": "none",
17+
"one_signal_config": null,
18+
"pusher_config": null,
19+
"show_debug_panel": true,
20+
"debug_panel_color": 3422552064
21+
}

assets/env/production.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"app_title": "VaahFlutter",
3+
"app_title_short": "VaahFlutter",
4+
"env_type": "Production",
5+
"version": "1.0.0",
6+
"build": "1",
7+
"backend_url": "",
8+
"api_url": "",
9+
"firebase_id": null,
10+
"timeout_limit": 20000,
11+
"enable_local_logs": false,
12+
"enable_cloud_logs": false,
13+
"enable_api_log_interceptor": false,
14+
"sentry_config": null,
15+
"push_notifications_service_type": "none",
16+
"internal_notifications_service_type": "none",
17+
"one_signal_config": null,
18+
"pusher_config": null,
19+
"show_debug_panel": false,
20+
"debug_panel_color": 3422552064
21+
}

assets/env/staging.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"app_title": "VaahFlutter",
3+
"app_title_short": "VaahFlutter",
4+
"env_type": "Staging",
5+
"version": "1.0.0",
6+
"build": "1",
7+
"backend_url": "",
8+
"api_url": "",
9+
"firebase_id": null,
10+
"timeout_limit": 20000,
11+
"enable_local_logs": false,
12+
"enable_cloud_logs": false,
13+
"enable_api_log_interceptor": false,
14+
"sentry_config": null,
15+
"push_notifications_service_type": "none",
16+
"internal_notifications_service_type": "none",
17+
"one_signal_config": null,
18+
"pusher_config": null,
19+
"show_debug_panel": true,
20+
"debug_panel_color": 3422552064
21+
}

lib/app_config.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:sentry_flutter/sentry_flutter.dart';
44

55
import 'routes/middleware.dart';
66
import 'vaahextendflutter/app_theme.dart';
7-
import 'vaahextendflutter/env.dart';
7+
import 'vaahextendflutter/env/env.dart';
88
import 'vaahextendflutter/widgets/debug.dart';
99

1010
final _navigatorKey = GlobalKey<NavigatorState>();
@@ -14,7 +14,7 @@ class AppConfig extends StatelessWidget {
1414

1515
@override
1616
Widget build(BuildContext context) {
17-
EnvironmentConfig env = EnvironmentConfig.getEnvConfig();
17+
EnvironmentConfig env = EnvironmentConfig.getConfig;
1818
return GetMaterialApp(
1919
title: env.appTitle,
2020
theme: ThemeData(

lib/vaahextendflutter/base/base_controller.dart

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:get_storage/get_storage.dart';
77
import 'package:sentry_flutter/sentry_flutter.dart';
88

99
import '../app_theme.dart';
10-
import '../env.dart';
10+
import '../env/env.dart';
1111
import '../services/api.dart';
1212
import '../services/dynamic_links.dart';
1313
import '../services/notification/internal/notification.dart';
@@ -24,8 +24,9 @@ class BaseController extends GetxController {
2424
await GetStorage.init();
2525

2626
// Environment initialization
27-
EnvironmentConfig.setEnvConfig();
28-
final EnvironmentConfig config = EnvironmentConfig.getEnvConfig();
27+
final envController = Get.put(EnvController());
28+
await envController.initialize();
29+
final EnvironmentConfig config = EnvironmentConfig.getConfig;
2930

3031
// Initialization of Firebase and Services
3132
if (firebaseOptions != null) {

0 commit comments

Comments
 (0)