read method

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

The secret stored under handle, or null when nothing is.

A miss is an ordinary answer, not an error: a wiped keychain, a restored machine and a first run are all the same situation here.

Implementation

@override
Future<String?> read(String handle) async {
  _checkName(handle, 'handle');
  try {
    final stored = switch (_os) {
      'macos' => await _macRead(handle),
      'windows' => _windowsRead(handle),
      _ => await _linuxRead(handle),
    };
    return stored == null ? null : _decode(stored);
  } on TomSecretStoreException {
    rethrow;
  } on Object catch (e) {
    throw TomSecretStoreException(TomSecretStoreStep.read, e);
  }
}