request method

Future<Map<String, Object?>> request(
  1. String op, [
  2. Map<String, Object?> fields = const {}
])

Sends the admin request op with fields; answers the answer, or throws TomSecretsAdminException for an error.

Implementation

Future<Map<String, Object?>> request(
  String op, [
  Map<String, Object?> fields = const {},
]) async {
  final id = _nextId++;
  final c = Completer<Map<String, Object?>>();
  _pending[id] = c;
  _send({...fields, 'op': op, 'id': id});
  final answer = await c.future;
  _throwIfError(answer);
  return answer;
}