containsKey static method

Future<bool> containsKey({
  1. required String key,
  2. Type type = Type.CRED_TYPE_GENERIC,
  3. bool encrypted = false,
  4. bool fAsSelf = false,
})

Implementation

static Future<bool> containsKey({
  required String key,
  Type type = Type.CRED_TYPE_GENERIC,
  bool encrypted = false,
  bool fAsSelf = false,
}) async {
  assert(key.isNotEmpty);
  assert(!fAsSelf || (fAsSelf && encrypted));
  try {
    return await _channel.invokeMapMethod<String, dynamic>('get', {
      'key': key,
      'type': type.index + 1,
      'encrypted': encrypted,
      'fAsSelf': fAsSelf,
    }).then((data) {
      if (data == null) return false;
      return true;
    });
  } catch (err) {
    if (err is PlatformException && err.code != 'ERROR_NOT_FOUND')
      throw err;
    else
      return false;
  }
}