read method

  1. @override
Future<String?> read(
  1. String key
)
override

The default value of key, or null when the key is not there.

Implementation

@override
Future<String?> read(String key) async {
  final r = await Process.run('reg', ['query', key, '/ve']);
  if (r.exitCode != 0) return null;
  for (final line in LineSplitter.split('${r.stdout}')) {
    final at = line.indexOf('REG_SZ');
    if (at >= 0) return line.substring(at + 'REG_SZ'.length).trim();
  }
  return null;
}