execute method

  1. @override
Future<OperationResult<Data, Variables>> execute()
override

Implementation

@override
Future<OperationResult<Data, Variables>> execute() async {
  bool shouldRetry = await _shouldRetry();
  try {
    // Logic below is duplicated due to the fact that `executeOperation` returns
    // an `OperationResult` here, and `QueryRef` expects a `QueryResult`.
    OperationResult<Data, Variables> r = await _executeOperation(_lastToken);
    return r;
  } on DataConnectError catch (e) {
    if (shouldRetry &&
        e.code == DataConnectErrorCode.unauthorized.toString()) {
      return _executeOperation(_lastToken);
    } else {
      rethrow;
    }
  }
}