execute method

  1. @override
List execute(
  1. List results,
  2. Map<String, dynamic> passed
)
override

The iterable, nested function that evaluates the entire FHIRPath expression one object at a time

Implementation

@override
List execute(List results, Map<String, dynamic> passed) {
  final executedValue = value.execute(results.toList(), passed);
  return executedValue.length != 1 || executedValue.first is! int
      ? throw FhirPathEvaluationException(
          'The argument passed to the .skip() function was not valid.',
          operation: '.skip()',
          arguments: value,
        )
      : executedValue.first == null
      ? throw FhirPathEvaluationException(
          'The value for .skip() was not a number: ${executedValue.first}',
          operation: '.skip()',
          arguments: executedValue.first,
        )
      : (executedValue.first as int) <= 0
      ? results
      : results.isEmpty || (executedValue.first as int) >= results.length
      ? []
      : results.sublist(executedValue.first as int);
}