findByName method

Future<Map<String, dynamic>?> findByName({
  1. required Dio apiDio,
  2. required String name,
})

Used by keys revoke's in-use check and the login --key #74 orphan warning — both need "is there an active key with this exact name", not the whole list.

Implementation

Future<Map<String, dynamic>?> findByName({
  required Dio apiDio,
  required String name,
}) async {
  final keys = await list(apiDio: apiDio);
  for (final key in keys) {
    if (key['name'] == name) return key;
  }
  return null;
}