aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils/app_config.dart
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/app_config.dart')
-rw-r--r--lib/utils/app_config.dart26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/utils/app_config.dart b/lib/utils/app_config.dart
new file mode 100644
index 0000000..8f5c566
--- /dev/null
+++ b/lib/utils/app_config.dart
@@ -0,0 +1,26 @@
+import 'dart:convert';
+import 'dart:async';
+import 'package:flutter/services.dart';
+
+class AppConfig {
+ late String grpcHost;
+ late int grpcPort;
+
+ AppConfig({required this.grpcHost, required this.grpcPort});
+
+ factory AppConfig.fromAsset() {
+ return AppConfig._();
+ }
+
+ AppConfig._();
+
+ static Future<AppConfig> loadFromAsset() async {
+ final configString = await rootBundle.loadString('assets/config.json');
+ final jsonMap = json.decode(configString);
+
+ return AppConfig(
+ grpcHost: jsonMap['grpc_host'],
+ grpcPort: jsonMap['grpc_port'],
+ );
+ }
+}