readKeysForAddr method Null safety

Future<Tuple2<List<int>, List<int>>?> readKeysForAddr(
  1. String addr
)

Implementation

Future<Tuple2<List<int>, List<int>>?> readKeysForAddr(String addr) async {
  // Read from GetStorage if Debug
  if (isDebugMode || _enabledStorage) {
    try {
      final dsc = _tempStorage.read(_dscKeyForDid(addr));
      final psk = _tempStorage.read(_pskKeyForDid(addr));
      if (dsc != null && psk != null) {
        return Tuple2(_decodeHexString(dsc), _decodeHexString(psk));
      }
    } catch (e) {
      Log.warn("Failed to read AES Keys from GetStorage $e");
    }
  } else {
    // Read from Keychain
    final dsc = await FlutterKeychain.get(key: _dscKeyForDid(addr));
    final psk = await FlutterKeychain.get(key: _pskKeyForDid(addr));
    if (dsc != null && psk != null) {
      return Tuple2(_decodeHexString(dsc), _decodeHexString(psk));
    }
  }
  return null;
}