From 8417e9daeecbdb3847de401b0fcc6304d246a787 Mon Sep 17 00:00:00 2001 From: Malik Talha Date: Mon, 23 Oct 2023 02:00:01 +0500 Subject: Add flutter voice assistant app A flutter based gRPC client Voice Assistant made specifically to communicate with the Voice Agent service. SPEC-4906 Signed-off-by: Malik Talha Change-Id: Ic4a382c1cdb78f1a79f985e3d37ce2fb06c53203 --- lib/utils/app_config.dart | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/utils/app_config.dart (limited to 'lib/utils') 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 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'], + ); + } +} -- cgit 1.2.3-korg