From f07fe888249cb9236b45bdba1a423bbae1d1aaa3 Mon Sep 17 00:00:00 2001 From: Aleksey Kulikov Date: Fri, 18 Jun 2021 18:15:33 +0300 Subject: [PATCH] feat(config): update example --- example/config_example.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/example/config_example.dart b/example/config_example.dart index bed8886..57f02aa 100644 --- a/example/config_example.dart +++ b/example/config_example.dart @@ -17,12 +17,20 @@ void main() { try { final repoConfig = Config.open(path: '.git/config'); - print('All entries of repo config:'); + print('\nAll entries of repo config:'); final entries = repoConfig.getEntries(); for (final entry in entries.entries) { print('${entry.key}: ${entry.value}'); } + // Set value of config variable + repoConfig.setValue('core.variable', 'value'); + print( + '\nNew value for variable "core.variable": ${repoConfig.getValue('core.variable')}'); + + // Delete variable + repoConfig.deleteEntry('core.variable'); + repoConfig.close(); } catch (e) { print(e); @@ -33,7 +41,7 @@ void main() { try { final globalConfig = Config.global(); - // get value of config variable + // Get value of config variable. final userName = globalConfig.getValue('user.name'); print('\nUser Name from global config: $userName');