isOptionalParam method

bool isOptionalParam(
  1. String key
)

Checks whether the placeholder with the given key is optional.

Throws ApiError when the key is not present in the pattern.

Implementation

bool isOptionalParam(String key) {
  final segment = _segments.firstWhere(
          (element) => element is _PLSegment && element.key == key,
          orElse: () => throw ApiError(
              'Placeholder param "$key" not present in pattern: $pattern'))
      as _PLSegment;
  return segment.optional;
}