diff --git a/lib/utils/system_util.dart b/lib/utils/system_util.dart index 3c7a380..bd95b39 100644 --- a/lib/utils/system_util.dart +++ b/lib/utils/system_util.dart @@ -2,6 +2,8 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'package:yaml/yaml.dart'; + Map?> envArguments(List arguments) { var dic = ?>{}; var list = []; @@ -51,6 +53,18 @@ Map? getMapFromJson(String jsonStr) { return map; } +Map? getMapFromYaml(String yamlStr) { + Map? map; + if (yamlStr.length > 5) { + try { + map = jsonDecode(jsonEncode(loadYaml(yamlStr))); + } catch (e) { + print("Error: $e"); + } + } + return map; +} + Future getIPAddress(String domain) async { var c = Completer(); var ipAddress; diff --git a/pubspec.yaml b/pubspec.yaml index 62aa1e4..fb47cf4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,6 +13,7 @@ dependencies: json_annotation: ^4.8.0 archive: ^3.3.5 ftpconnect: ^2.0.5 + yaml: ^3.1.1 dev_dependencies: lints: ^2.0.0